Question
In C++ Implement a class to play the game of tic-tac-toe with two players. The class contains as private data member a 3 by 3
In C++ Implement a class to play the game of tic-tac-toe with two players. The class contains as private data member a 3 by 3 array of integers. The constructor should initialize the empty
board to zeros. When the first player moves, place 1 in the specified square; place 2 when the second player moves. Each move must be done in an empty square. After each move, determine if the game has been won or if the game is a draw.
The header, implementation and driver programs should be respectively named: TicTacToe.h, TicTacToe.cpp and TestTicTacToe.cpp
Please post a snap of your sample output to see if it works. Thanks
A sample run follows Player1 move: 1 1 1 0 0 Player2 move: 2 2 1 0 0 0 2 0 Player1 move: 3 1 1 0 0 0 2 0 1 0 0 Player2 move: 1 1 1 1 is used. Please choose another move: 3 3 1 0 0 0 2 0 1 0 2 Player1 move: 2 1 1 0 0 1 2 0 1 0 2 Player1 winsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started