Question: Hello I need some help writing this C++ code. The program is a tic tac toe program. Write a program that allows two players (X

Hello I need some help writing this C++ code.

The program is a tic tac toe program. Write a program that allows two players (X and O) to play the tic-tac-toe game on a 3 by 3 two-dimensional array board. Some of the operations on a ticTacToe object are printing the current board, getting a move, checking if a move is valid and determining the winner after each move. Add additional operations as needed. Pseudo code is done. I could use some help filling it in c++.

#include

using namespace std;

enum status {win, draw, continue};

class ticTacToe {

public:

void play(); //function to start to play game

void displayBoard() const; // function to print board

boolisValidMove(int x, int y) const; //function to determine if a move is valid

bool getXOmove (char moveSymbol); //Function to get a move for a player

status gameStatus(); //Function to determine the current status for the game

void reStart(); //Function to restart the game.

ticTacToe(); //Default constructor //Postcondition: Initializes the board to an empty state

private: char board[3][3]; int noOfMoves;

};

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!