int map[5][5] =
{
1, 1, 1, 1, 1,
1, 0, 0, 0, 1,
1, 0, 2, 0, 1,
1, 0, 0, 0, 1,
1, 1, 1, 1, 1
};
int column = 0;
int column2 = 0;
()void print_map()
void print_map()
{
for (column = 0; column < 6; column++)
{
cout << map[column][column2];
if (column == 5)
{
column2++;
column = 0;
cout << endl;
}
if (column && column2 == 5)
{
break;
}
}
}
This is my code for printing out a 2d array.What happens in the output though, is unexpected. It produces:
111110
00010
02010
00010
11110
1
Instead of:
11111
10001
10201
10001
11111
1. How can I fix this problem?
2. Can you call the an if command an exception?
3. Please don't post the fixed code. Just give me hints, unless the code is beyond fixing.






