Computer Science Canada

can anyone help me with two dimensional arrays?

Author:  sevendust [ Tue Nov 30, 2004 2:08 pm ]
Post subject:  can anyone help me with two dimensional arrays?

heres the question i cant figur out...
write a program that creates a 4x4 array called BINARY containing integers. load the array with a 1 when the row and colummn are the same and a 0 when the row and column are different.i.e binary(1, 1)=1, binary (2,2)=1, etc, all other elements are 0....thanks to the person who can email me the answer at richardo1988@hotmail.com or post it here, thanks very much

Author:  Martin [ Tue Nov 30, 2004 2:38 pm ]
Post subject: 

Search the forums, there are a million array tutorials.

http://www.compsci.ca/v2/search.php

Author:  Cervantes [ Tue Nov 30, 2004 6:02 pm ]
Post subject: 

Arrays and for loops are built to work together. Use those for loops. You've got a 2-demensional array, so use 2 for loops. If the counters of the for loops are the same, make the array = 1, otherwise, make the array = 0.

Author:  Mr. Glib [ Tue Nov 30, 2004 9:51 pm ]
Post subject: 

sevendust, don't forget to use a check to see if the row and col numbers are equal to one another.

Author:  Andy [ Wed Dec 01, 2004 4:01 pm ]
Post subject: 

err wtf u talkin about.. wth does the row and col have to equal each other

Author:  SuperGenius [ Wed Dec 01, 2004 5:43 pm ]
Post subject: 

I think it's just a peculiar assignment.


: