Question: Construct a C++ program that will allow two users play tic-tac-toe. The program should ask for moves alternately from player F' and player S'. The

Construct a C++ program that will allow two users play tic-tac-toe. The program should ask for moves alternately from player F' and player S'. The program displays the game position as follows:

1 2 3

4 5 6

7 8 9

The players enter their moves by entering the position number they wish to mark. After each move, the program displays the changed board. A sample board configuration is as follows:- assuming player F' chose 1 followed by 2 and player S' chose 3 and 7.

X X O

4 5 6

O 8 9

Once all 9 positions are chosen, program should determine and print who's the winner.

follow these steps:

1. Create a function void b(char DB[]) - this function should display a board on the screen. It should output each character in an array, putting a newline every three characters.

2. Declare and use an array named tic that should hold digits 'X' and 'O' . Initialize tic[ ] to character digits 1-9. Get a move until all 9 moves used. Validate that moves are between 1-9.

3. Determine and Declare the winner.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!