Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Demystifying Databases A Hands On Guide For Database Management

Authors: Shiva Sukula

1st Edition

8170005345, 978-8170005346

More Books

Students also viewed these Databases questions