Computer Science Canada

how can i sort two sets of data into a 2D array

Author:  jennil [ Mon Jan 19, 2004 11:20 pm ]
Post subject:  how can i sort two sets of data into a 2D array

I was wonderin if neone knows the code of entering data into a 2D arry and writin the two separate lists of int into a new text file?

this is probably really simple, but i havn't done this in a while! thnx!

Author:  DanShadow [ Mon Jan 19, 2004 11:29 pm ]
Post subject: 

hmm...thats a little tough...but it might be something like this:
code:

var area:array 1..10, 1..10 of int
var x,y:int:=1
loop
array(x,y):=Rand.Int(1,99)
x:=x+1
y:=y+1
exit when x=11 or y=11
end loop
var datafile:int
open:datafile,"2d array",put
loop
put:datafile,array(x,y)
x:=x+1
y:=y+1
exit when x=11 or y=11
end loop
close:datafile

Im quite sure that wont work...(I dont have Turing on me right now).
But that might give you an idea, so either way, I hope it helps in some wa y. Very Happy

Author:  jennil [ Mon Jan 19, 2004 11:31 pm ]
Post subject: 

thnx


: