Question

C++: Develop a simple Tc-Tac-Toe game between a human and the computer. Place the Tac-Tac-Toe board...

C++:

Develop a simple Tc-Tac-Toe game between a human and the computer.
Place the Tac-Tac-Toe board in an array of char (e.g., char board[9] ) and use functions to create "operations" from which you can build a game (see class notes, for example: reset(), Go(), display(), etc.... avoid an over used of global variables, use constants instead of pure numbers or characters, provide comments for other programmers to see how your code works.

Homework Answers

Answer #1

#include<iostream>

using namespace std;

char board[10]={'0','1','2','3','4','5','6','7','8','9'};

int checkwin();

void drawboard()

{

cout<<" "<<board[1]<<"|"<<board[2]<<"|"<<board[3]<<endl;

cout<<"--|-|--"<<endl;

cout<<" "<<board[4]<<"|"<<board[5]<<"|"<<board[6]<<endl;

cout<<"--|-|--"<<endl;

cout<<" "<<board[7]<<"|"<<board[8]<<"|"<<board[9]<<endl;

}

int main()
{
drawboard();
}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a program that allows two players to play a game of tic-tac-toe. Use a twodimensional...
Write a program that allows two players to play a game of tic-tac-toe. Use a twodimensional char array with three rows and three columns as the game board. Each element in 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...
For a C program hangman game: Create the function int setup_game [int setup_game ( Game *g,...
For a C program hangman game: Create the function int setup_game [int setup_game ( Game *g, char wordlist[][MAX_WORD_LENGTH], int numwords)] for a C program hangman game. (The existing code for other functions and the program is below, along with what the function needs to do) What int setup_game needs to do setup_game() does exactly what the name suggests. It sets up a new game of hangman. This means that it picks a random word from the supplied wordlist array and...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how the firms resources incompetencies support the given pressures regarding costs and local responsiveness. Describe entry modes have they usually used, and whether they are appropriate for the given strategy. Any key issues in their global strategy? casestudy: Atlanta, June 17, 2014. Sea of Delta employees and their families swarmed between food trucks, amusement park booths, and entertainment venues that were scattered throughout what would...
What tools could AA leaders have used to increase their awareness of internal and external issues?...
What tools could AA leaders have used to increase their awareness of internal and external issues? ???ALASKA AIRLINES: NAVIGATING CHANGE In the autumn of 2007, Alaska Airlines executives adjourned at the end of a long and stressful day in the midst of a multi-day strategic planning session. Most headed outside to relax, unwind and enjoy a bonfire on the shore of Semiahmoo Spit, outside the meeting venue in Blaine, a seaport town in northwest Washington state. Meanwhile, several members of...