Tic-Tac-Toe Multi-Dimensional Array

Hello, I have to create a tic tac toe game with a multi- dimensional array table numbered 1-9 with three rows and three Columns for my computer class. I know that I need to have a for loop inside a for loop but I don't know where to take it from there to get a table that looks somewhat like this:

1 2 3
4 5 6
7 8 9

the other trick is that playerx and playero would replace the number spot with their respective letter. I know I'm kinda clueless but it would be awesome if someone could please start me in the right direction, I am not looking for the answer just some help! Thank you so much.
Make a 2D array like so:
int grid[3][3];

now use 2 for loops, to set each element:
1
2
3
for (int i = 0; i < 3; i++)
  for (int j = 0; j < 3; j++)
    grid[i][j] = j + 3*i + 1;


Now do the same thing to access each element:
1
2
3
4
5
6
for (int i = 0; i < 3; i++)
{
  for (int j = 0; j < 3; j++)
    std::cout << grid[i][j] << ' ';
  std::cout << std::endl;
}
Topic archived. No new replies allowed.