#include using namespace std; void displayGrid(char a[][3]) { // Row for(int row=0;row<3;row++) { // Column for(int column=0;column<3;column++) { cout << a[row][column]; } // Go to the next line. cout << endl; } } void clearGrid(char a[][3]) { // Row for(int row=0;row<3;row++) { // Column for(int column=0;column<3;column++) { a[row][column]='.'; } } } void setGrid(char a[][3]) { int row; int column; char symbol; cout << "What symbol do you want to store: "; cin >> symbol; cout << "Enter in a row from 1 to 3 : "; cin >> row; cout << "Enter in a column from 1 to 3 : "; cin >> column; // Adjust values. row--; column--; // Only if valid locations, assign a star. if(row>=0 && row<=2 && column>=0 && column<=2) { a[row][column]=symbol; } else cout << "Invalid location!" << endl; } int main() { char grid[3][3]; clearGrid(grid); //grid[0]={'X','X','X'}; displayGrid(grid); setGrid(grid); setGrid(grid); displayGrid(grid); return 0; }