How to Cout a WHOLE array?

Hi!
I'm creating a game where a user is able to move. I'm powering movement using a multi-dimensional array ( [15][78] )

My question to the community, is how would I go about couting the contents of every entry of the array?

Below is a sample of a for loop that is designed to set the 1st entry of all lines to the hash key, and cout it.
1
2
3
4
5
6
7

for (int i=0;i<=15;i++;) {
map[i][1] = '#';
cout << map[i][1];
i++;
}



How would I set the first entry and last entry of each line to the hash, and then cout the whole array?
Have a pair of nested for loops to iterate over each index of the array.
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
using namespace std;

int main()
{
    int rows, columns;
    char numbers[15][78];
for(int row = 0; row < rows; row++)
        {
     for(int col = 0; col < columns; col++)
     cout << numbers[row][col] << " ";
     }
}


Is this what you were looking for?

EDIT: changed numbers[15][78] to a char.
Last edited on
@paulthepenguin: Don't just give solutions out like that. Better if TC actually has to think.
I wasn't sure how to explain it, and didn't want to leave him all by himself. Next time I will think of a way to explain it without giving out the answer.
Topic archived. No new replies allowed.