I'm messing around with a tic tac toe game using c++ and i've created a function for the user input. Instead of using numerous if statements to check the 3x3 matrix numbers (there would be 9) I'm trying to put this into a loop and have this so far. Not sure i'f i'm going about this wrong but nothing is happening when trying to input the 'X'.
// this is the array
char board[3][3] = { '1', '2', '3', '4', '5', '6', '7', '8', '9' };
void Input()
{
int a;
cout << "Enter the number of the cell you wish to place: ";
cin >> a;
for (int i = 0; i < 9; i++)
{
for (int j = 0; j < 9; j++)
{
if (board[i][j] == a)
{
board[i][j] = player;
}
}
}
}