Question
use visual studio and Write a c++ program that allows two different people to play tic-tac-toe. Here are the programming guidelines: -The Modular programming Technique
use visual studio and Write a c++ program that allows two different people to play tic-tac-toe.
Here are the programming guidelines:
-The Modular programming Technique MUST BE USED! What does modular programming mean? You must break youe code down into specific "chunks" or "block" of functions that can be called throughout the program. For example, you may want to have a function that updates the board display. Another function to get input, another function to check for a winner. You decide how many functions and what each will do.
- Data structure: a [3][3] array must be used for the data.
-winner state: use a boolean variable called winner to track if the game has a winner. set the variable to false at the beggining of the program and when a user gets 3 in a row, set it to true .
- Graphics and User Interaction: Because you have not learned graphics command in C++, you will need to do your best with how the game board look. You can use chars of "X" and "Y" or use integers 1 and 2 to represent X & Y respectfully. 0 will represent a blank square. The playing board should be displayed on the screen and be updated after each player turn. At a minimum the board on the screen should look like:
000
000
000
As the players play, the board should look like:
012
102
100
- User Input: Input player's name (instead of using player1 or player2). Each user will select which square to select by designating a row and column. For example, if the user wants to select the top right corner, the row is 1, column 3. If the user wants to select the bottom middle square, the row is 3 and the column is 2.
Error Checking: all user input must be error checked. Meaning, is a user input inputs row 4 and column 0, the program should ask the user to input valid inputs.
comments in the code: Yes
The winner: When a player wins with 3 across, 3 down or 3 diagonal, the game should stop and display who the winner is.If neither one wins, then the "cat" gets the win.
Step 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