include

#include
using namespace std;

char square10 = {‘o’,’1′,’2′,’3′,’4′,’5′,’6′,’7′,’8′,’9′};

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!


order now

int checkwin();
void board();

int main()
{
int player = 1,i,choice;

char mark;
do
{
board();
player=(player%2)?1:2;

cout > choice;

mark=(player == 1) ? ‘X’ : ‘O’;

if (choice == 1 && square1 == ‘1’)

square1 = mark;
else if (choice == 2 && square2 == ‘2’)

square2 = mark;
else if (choice == 3 && square3 == ‘3’)

square3 = mark;
else if (choice == 4 && square4 == ‘4’)

square4 = mark;
else if (choice == 5 && square5 == ‘5’)

square5 = mark;
else if (choice == 6 && square6 == ‘6’)

square6 = mark;
else if (choice == 7 && square7 == ‘7’)

square7 = mark;
else if (choice == 8 && square8 == ‘8’)

square8 = mark;
else if (choice == 9 && square9 == ‘9’)

square9 = mark;
else
{
coutaPlayer “aGame draw”;

cin.ignore();
cin.get();
return 0;
}
int checkwin()
{
if (square1 == square2 && square2 == square3)

return 1;
else if (square4 == square5 && square5 == square6)

return 1;
else if (square7 == square8 && square8 == square9)

return 1;
else if (square1 == square4 && square4 == square7)

return 1;
else if (square2 == square5 && square5 == square8)
void board()
{
system(“cls”);
cout