The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 399 Weeks Ago, 1 Day Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
Hello! Can someone help me with this aissignment. Thanks
Â
Write a modular program that allows two players to play a game of tic-tac-toe. Use a twodimensional char array with 3 rows and 3 columns as the game board. Each element of the array should be initialized with an asterisk (* ). The program should display the initial
board configuration and then start a loop that does the following:
• Allow player 1 to select a location on the board for an X by entering a row and column number. Then redisplay the board with an X replacing the *. in the chosen location.
• If there is no winner yet and the board is not yet full, allow player 2 to select a location on the board for an 0 by entering a row and column number. Then redisplay the board with an 0 replacing the * in the chosen location.
The loop should continue until 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.
Â
You are required to use a class to accomplish the program. The class should have a two dimensional array of either the char type as a private variable. The class could have some other private variables needed. A constructor must be a public member and it should be used to initialize private variables. Remember that a you need two loops to access all rows and columns to initialize each array element.
Â
There must be other public functions to do tasks such as XPlay, OPlay, DetermineAWinner, and others as needed. The main should have a loop to repeat tasks until there is a winner or a tie.
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll