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 D as input.
The user enters which is already occupied by an
The user will enter A B or C and or However, in your D grid array, the Xs and Os will be
placed at different index values for rowcolumn 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
readInitialGrid function will read the Input.txt file to initialize the game grid D
array. This function will be void and receive the game grid D array and ifstream variable as
a parameter.
initiatlizeGrid function will initialize only the game cells where and are placed after a
game is played. This function will be void and receive the game grid D array as a parameter.
displayGrid function will print each cell of the D grid to the console window. This function
will be void and receive the game grid D array as a parameter.
isWin function will determine if or have won the game. It will return true if there is a
winner and false otherwise. It will reeeive the game grid D array and count of moves as
parameters.
Be sure to declare and use constants for and space characters.
Be sure to declare constants ROWS and COLS, and use them in the declaration of the 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 XO 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 dowhile
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 dowhile loop.
Be sure to have documentation headers on each function.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
