Question: Please complete in C + + programming The user enters D 7 as input. The user enters A l , which is already occupied by

Please complete in C++ programming
The user enters D7 as input.
The user enters Al, which is already occupied by an x.
The user will enter A, B, or C and 1,2, or 3. However, in your 2-D grid array, the Xs and Os will be
placed at different index values for row/column. You will need to make that translation from the user's
input to your grid coordinates.
You are required to write the following functions. All of these functions will be called by main().
readInitialGrid()
isWin(0)
readInitialGrid function will read the Pgm7_Input.txt file to initialize the game grid 2-D
array. This function will be void and receive the game grid 2-D array and ifstream variable as
a parameter.
initiatlizeGrid function will initialize only the game cells where xss and Os are placed after a
game is played. This function will be void and receive the game grid 2-D array as a parameter.
displayGrid function will print each cell of the 2-D grid to the console window. This function
will be void and receive the game grid 2-D array as a parameter.
isWin function will determine if xs or O have won the game. It will return true if there is a
winner and false otherwise. It will reeeive the game grid 2-D array and count of moves as
parameters.
Be sure to declare and use constants for 'x,'O', and space characters.
Be sure to declare constants ROWS and COLS, and use them in the declaration of the 2-D
array.
Be sure to prototype all of your functions.
Be sure to verify that the data file was opened correctly and closed when you are done reading
the data. The program should do nothing else, if the data file cannot be opened comectly.
Be sure to use switch statements to translate user input of columns and rows to the grid
indexes.
Be sure to use a bool variable to keep track of X/O turn. Alternate the turns. Xs always start.
Be sure to validate the user's input when asking if they want to play again. Hint: Use do-while
loop.
Be sure to validate the user's input when asking for the next move. You may assume that the
user will enter a column letter followed by an integer. Hint: Use the do-while loop.
Be sure to have documentation headers on each function.
Please complete in C + + programming The user

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 Accounting Questions!