can anyone help me with two dimensional arrays?
Author |
Message |
sevendust
|
Posted: 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 |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Martin
![](http://www.compsci.ca/wiki/images/4/46/CanadianStickUp.jpg)
|
|
|
|
![](images/spacer.gif) |
Cervantes
![](http://compsci.ca/v3/uploads/user_avatars/1023105758475ab2e040bde.jpg)
|
Posted: Tue Nov 30, 2004 6:02 pm Post subject: (No 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. |
|
|
|
|
![](images/spacer.gif) |
Mr. Glib
![](http://bbs.stardestroyer.net/images/avatars/144307899641932e3f07841.jpg)
|
Posted: Tue Nov 30, 2004 9:51 pm Post subject: (No subject) |
|
|
sevendust, don't forget to use a check to see if the row and col numbers are equal to one another. |
|
|
|
|
![](images/spacer.gif) |
Andy
|
Posted: Wed Dec 01, 2004 4:01 pm Post subject: (No subject) |
|
|
err wtf u talkin about.. wth does the row and col have to equal each other |
|
|
|
|
![](images/spacer.gif) |
SuperGenius
|
Posted: Wed Dec 01, 2004 5:43 pm Post subject: (No subject) |
|
|
I think it's just a peculiar assignment. |
|
|
|
|
![](images/spacer.gif) |
|
|