This must be in C++ You have decided to use your skills to develop a program that will allow you to enjoy a few minutes of game playing at work. You review a list of your favorite games from your childhood and remember how much you loved tic-tac-toe. You believe that it will be a relatively easy program to develop so you jump on it. Write a program that allows two players to play the game. Use a two-dimensional char array with three rows and three columns as the game board. Each element of the array should be initialized with an asterisk (*). I STRONGLY recommend you write a function that accepts the two-dimensional array as one of its arguments. This function will display the contents of the two dimensional array. Call this function each time you need to display (or re-display) the contents of the array. The program should display the initial board configuration and then start a loop that does the following: Have player 1 select a board location for an "X" by entering a row number and a column number. Then clear the screen (suing the clearscreen function I emailed to each of you), redisplay the board with an "X" replacing the * in the chosen location. After each move (starting with the fifth legal move of the game), the program will call a function to determine if there is a winner for the game by passing the two-dimensional array into the function and returning who the winner is (should return a string). This function will be called starting with the 5th legal move through legal move #9 OR a winner has been declared. If there is no winner yet and the board is not yet full, have player 2 select a board location for an "O" by entering a row and a column number. Then clear the screen (using the clearscreen function I sent you), redisplay the board with an "O" replacing the * in the chosen location. The loop should continue until either a player has won or a tie has occurred, then display a message indicating who won, or reporting that a tie occurred. Player 1 wins when there are three "Xs" in a row, a column, or a diagonal on the game board. Player 2 wins when there are three "Os" in a row, a column, or a diagonal on the game board. A tie occurs when all of the locations on the board are full, but there is no winner. Input validation: Only allow legal moves to be entered. The row and column must be 1,2 or 3. The selected board location MUST currently be empty (i.e., still have an asterisk in it). If it is not available, then a message should be displayed that the selected position is not available AND allow the user to re-enter a new board location. Your program SHOULD NOT go back to the other player. For example, if Player 2 chooses an incorrect location (one already taken), then Player 2 must be given a chance to choose another valid position until they choose an available position.
Oh no! Our experts couldn't answer your question.
Don't worry! We won't leave you hanging. Plus, we're giving you back one question for the inconvenience.
This must be in C++
-
You have decided to use your skills to develop a program that will allow you to enjoy a few minutes of game playing at work. You review a list of your favorite games from your childhood and remember how much you loved tic-tac-toe. You believe that it will be a relatively easy program to develop so you jump on it.
Write a program that allows two players to play the game. Use a two-dimensional char array with three rows and three columns as the game board. Each element of the array should be initialized with an asterisk (*). I STRONGLY recommend you write a function that accepts the two-dimensional array as one of its arguments. This function will display the contents of the two dimensional array. Call this function each time you need to display (or re-display) the contents of the array. The program should display the initial board configuration and then start a loop that does the following:
- Have player 1 select a board location for an "X" by entering a row number and a column number. Then clear the screen (suing the clearscreen function I emailed to each of you), redisplay the board with an "X" replacing the * in the chosen location.
- After each move (starting with the fifth legal move of the game), the program will call a function to determine if there is a winner for the game by passing the two-dimensional array into the function and returning who the winner is (should return a string). This function will be called starting with the 5th legal move through legal move #9 OR a winner has been declared.
- If there is no winner yet and the board is not yet full, have player 2 select a board location for an "O" by entering a row and a column number. Then clear the screen (using the clearscreen function I sent you), redisplay the board with an "O" replacing the * in the chosen location.
The loop should continue until either a player has won or a tie has occurred, then display a message indicating who won, or reporting that a tie occurred.
- Player 1 wins when there are three "Xs" in a row, a column, or a diagonal on the game board.
- Player 2 wins when there are three "Os" in a row, a column, or a diagonal on the game board.
- A tie occurs when all of the locations on the board are full, but there is no winner.
Input validation: Only allow legal moves to be entered. The row and column must be 1,2 or 3. The selected board location MUST currently be empty (i.e., still have an asterisk in it). If it is not available, then a message should be displayed that the selected position is not available AND allow the user to re-enter a new board location. Your program SHOULD NOT go back to the other player. For example, if Player 2 chooses an incorrect location (one already taken), then Player 2 must be given a chance to choose another valid position until they choose an available position.






