Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help me to code this in C++. Please use Visual Studio You are going to use a 2D array to create a program that
Please help me to code this in C++. Please use Visual Studio
You are going to use a 2D array to create a program that allows two users to play tic-tac-toe. Steps 1-3 are specifically focused on making sure that you understand how to use 2D arrays and required for the lab 1.Create a 2D character array in your main function and use nested for loops to fill the array with the letter 'e'to represent empty spaces 2. Create a nested loop to print the board on the screen 3. Alternate between two players: player'X'and player 'O. In their turn, each player will ask to place an "X or a 'O' in one of the 9 cells 4. The program will prompt both players, one at a time for the next move and the player will need to input 2 numbers for the coordinators of his/her play 5. Input validation: 1. Check that the space required by the player is empty 2. Check that the space required by the player is within the board bounces (each number can be 0, 1, or 2) 6. Program flow 1. Repeat until either someone wins or all spots are taken 1. Draw the board 2. Ask for coordinators from alternate player as a 2 integer input between O and 2 3. Accommodate an 'A or a 'B' on the board 7. Report who the winner is, or tie, if nobody won. Congratulate the winner 8. Ask if they want to play again (y) and start all over if they doStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started