Question: Create a class tic-tac-toe that will enable you to write a complete program to play the well known game tic-tac-toe. The class contains as private

Create a class tic-tac-toe that will enable you to write a complete program to play the well known game tic-tac-toe. The class contains as private data a 3-by-3 two-dimensional array of integers. The constructor member function of the class should initialize the empty board to all zeros.

Allow two human players. Wherever the first player moves, place a 1 in the specified square; place a 2 wherever the second player moves. Each move must be to an empty square. After each move, print the current situation of the game, that is the tic-tac-toe board. Also, after each move, determine whether the game is over (that is, either player one or two won the game), or if the game is a draw. If so, print a message "Player x won the game" or "The game is a draw".

USE C++

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!