Lol, you just learned one of your first important programming lessons...
But before you run off and create a new account or start over on a new forum... here's a different perspective.
I'm doing a 3x3 instead of 10x10 to type less, because I'm lazy too.
You have a board:
0 1 2 3
\-------
1|a b c
2|d e f
3|g h i
To run through every possibility in that board you would need to access the following points:
(1, 1), (1, 2), (1, 3),
(2, 1), (2, 2), (2, 3),
(3, 1), (3, 2), (3, 3)
If you only needed to run through a 1D array, you would use a single for loop. For example, to print out "1 2 3 " you would use:
1 2 3
|
for (unsigned i = 1 ; i <= 3 ; ++i) {
cout << i << ' ';
}
| |
If you wanted to go down a single row or a single column, you could do this:
1 2 3
|
for (unsigned i = 1 ; i <= 3 ; ++i) {
cout << array[0][i] << ' ';
}
| |
If you wanted to print all of it you can do:
1 2 3 4 5
|
for (unsigned i = 1 ; i <= 3 ; ++i) {
cout << array[0][i] << ' ';
cout << array[1][i] << ' ';
cout << array[2][i] << ' ';
}
| |
But of course if you need to do more than 3 it gets annoying to type all of that up, even with copy and paste, plus you'll probably get an F. So you need to figure out a way to automatically access the different columns. Make sense?
See the pattern there? Again you have a similar problem as with the 1D array. You need to figure out how to access array[0] then array[1] then array[2], it just happens that it has a [i] stuck to the end of it.
So, try again and good luck. The reason array[i][i] did not work is because you're only iterating over (0,0), (1,1), (2,2). See? You're still missing a lot of the square.
Good luck. And try not to piss people off. Keep in mind we're just trying to help but we get frustrated if you don't do some of the work yourself. I recommend swallowing your pride and apologizing. These guys on here are very knowledgeable. We do it for fun after all, and we don't want to do work for other people. It's like if your friend asked you to help him move to a new house and he stood back and expected you to do his work for him. You'd leave.