|
Post by honky on Nov 6, 2024 9:47:05 GMT
Good morning, I have a string array of 8 columns and N lines as: "1 2 3 4 5 6 7 8" "9 10 11 ... ect ..." "... ect ..." I would like to read (and store) Each columns (col1$, col2$, col3$ ... ect ...) I may turn it in all directions. He does give me the lines, I cannot make him give the columns. How to do it? Thank you for.
|
|
|
Post by tsh73 on Nov 6, 2024 12:10:36 GMT
N=5 'change to taste
nCols=8 nRows=N
dim a$(N) 'initial string array
'fill k=0 for j = 1 to nRows aLine$="" for i = 1 to nCols k=k+1 aLine$=aLine$+" "+str$(k) next a$(j)=aLine$ next
'show for j = 1 to nRows print j;">", a$(j) next
'read any column for i = 1 to nCols print "column ";i;">", for j = 1 to nRows print word$(a$(j), i);" "; next print next
1> 1 2 3 4 5 6 7 8 2> 9 10 11 12 13 14 15 16 3> 17 18 19 20 21 22 23 24 4> 25 26 27 28 29 30 31 32 5> 33 34 35 36 37 38 39 40 column 1> 1 9 17 25 33 column 2> 2 10 18 26 34 column 3> 3 11 19 27 35 column 4> 4 12 20 28 36 column 5> 5 13 21 29 37 column 6> 6 14 22 30 38 column 7> 7 15 23 31 39 column 8> 8 16 24 32 40
|
|
|
Post by honky on Nov 6, 2024 12:27:00 GMT
Tank you tsh73 I've been breaking my head for this problem for three days. Which seems so simple when we have the solution. I persisted with that:
for c=2 to nCols ' and invert c and t for t=1 to nRows minmax(c,t)=val(word$(donn$,t)) ' and ...(donns,c) print minmax(c,t)'********* next t next c
It is not good to persist, we have to think. Big thank
|
|