Hi Im trying to create a random 2D array (3 x 3) so that numbers 1-9 will randomly be placed in the grid behind the '?' shown in coveredarray but in the guessarray just wanted to know if im doing right, im faily new to C++, also i wanted to ask how I would go about asking the user to pick what row and column to choose to reveal what numbers behind the '?'
Thanks
int coveredarray [3][3] = {{'?','?','?'},
{'?','?','?'},
{'?','?','?'}};
for(int row = 0; row < 3; row++)
{
for(int column = 0; column < 3; column++)
{
cout << coveredarray[row][column] << " ";
}
cout << endl;
}
//This is the Guess Array
int guessarray[3][3]; {{'?','?','?'},
{'?','?','?'},
{'?','?','?'}};
*srand(time(0)); // Initialize random number generator.
guessarray = (rand() % 3) ;
if (guessarray>1 && guessarray <9);
for(int row = 0; row <3; row++)
{ for(int column = 0; column <3; column++)
{ cout << guessarray[row][column];
}
}
}