Define a two-dimensional array for representing a tic-tac-toe board like this: +---+---+---+ | x | 0 | x || +---+---+---+ |0 |0 | +---+---+- - -+ | x +---+---+---+ The board has three rows and columns...


Define a two-dimensional array for representing a tic-tac-toe board like this:<br>+---+---+---+<br>| x | 0 | x ||<br>+---+---+---+<br>|0 |0 |<br>+---+---+- - -+<br>| x<br>+---+---+---+<br>The board has three rows and columns and contains strings
2 #include 3 using namespace std; 4 5 const int COLS = 3; const int ROWS = 3; 7 void print(string a[][COLS], int rows); int main() 8 9 10 { string board[ROWS][COLS] = { 11 12 13 14 }; 15 16 print(board, ROWS); 17 18 return 0; } 19 "/>
Extracted text: Define a two-dimensional array for representing a tic-tac-toe board like this: +---+---+---+ | x | 0 | x || +---+---+---+ |0 |0 | +---+---+- - -+ | x +---+---+---+ The board has three rows and columns and contains strings "x", "o", and " ". The print function will add the borders when printing. tictactoe.cpp 1 #include 2 #include 3 using namespace std; 4 5 const int COLS = 3; const int ROWS = 3; 7 void print(string a[][COLS], int rows); int main() 8 9 10 { string board[ROWS][COLS] = { 11 12 13 14 }; 15 16 print(board, ROWS); 17 18 return 0; } 19

Jun 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here