Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 2-dimensional arrays
Index -> Programming, Turing -> Turing Tutorials
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Thuged_Out_G




PostPosted: Sat Jan 24, 2004 12:11 am   Post subject: 2-dimensional arrays

2D ARRAYs

Quote:

var x_y:1..2,1..3


if you think of them as table, it makes sense ....1..2 if the number of collums, and 1..3 is the number of rows

Quote:

------------
|1,1 | 2,1|
------------
|1,2 | 2,2|
------------
|1,3 | 2,3|
------------


this could be useful for storing x and y coords of something.

code:

var x,y,button:int
loop
for i:1..3
Mouse.Where(x,y,button)
if button=1 then
x_y(1,i):=x
x_y(2,i):=y
end if
end for
end loop

for i:1..3
put "Xcoords: ",x_y(1,i)
put "Ycoords: ",x_y(2,i)
end for
Sponsor
Sponsor
Sponsor
sponsor
thoughtful




PostPosted: Sat Jan 24, 2004 12:19 am   Post subject: (No subject)

nice simple tutorial, yea just to point out, i have used 2D arrays with whatdotcolor (for saving pictures as text files basically getting the color of each dot) , i have also used it with database records. It can be very use ful.
JayLo




PostPosted: Sat Jan 24, 2004 9:43 am   Post subject: (No subject)

there's an alignment problem on this page.
Andy




PostPosted: Sat Jan 24, 2004 12:25 pm   Post subject: (No subject)

ummm i already had a tutorial on arrays that included multi dimensions
Tony




PostPosted: Sat Jan 24, 2004 2:23 pm   Post subject: (No subject)

i fixed the alighnment problem... it often occurs when multiple code tags are used. quote seems to not have such a probelem.

and yes... both dodge and I covered multidimentional arrays in our tutorials
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Tutorials
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: