Using C programing: printf, scanf 18. Tic-Tac-Toe Game Write a program that allo
ID: 3760082 • Letter: U
Question
Using C programing: printf, scanf
18. Tic-Tac-Toe Game Write a program that allows two players to play a game of tic-tac-toe. 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 (*). The program should run a loop that Displays the contents of the board array Allows player 1 to select a location on the board for an X. The program should ask the user to enter the row and column number. Arrays Allows player 2 to select a location on the board for an O. The program should ask the user to enter the row and column number. Determines whether a player has won, or a tie has occurred. If a player has won, the program should declare that player the winner and end. If a tie has occurred, the program should say so and end. Player 1 wins when there are three Xs in a row on the game board. The Xs can appear in a row, in a column, or diagonally across the board. A tie occurs when all of the locations on the board are full, but there is no winner.Explanation / Answer
#include #include using namespace std; const int SIZE = 3; char a[3][3] = { {'*','*','*'}, {'*','*','*'}, {'*','*','*'} }; char b = '0'; void draw(); bool getinputP1(); bool getinputP2(); bool checkwinP1(); bool checkwinP2(); int main() { draw(); coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.