SlideShare a Scribd company logo
Aryabhatta International College of Technical Education
Ajmer, Rajasthan
A
PROJECT REPORT
ON
TIC TAC TOE Game: C++
Submitted in partial fulfilment for
Award of the Degree of 2017 Year,
BACHELOR OF COMPUTER APPLICATION
Submitted to
Aryabhatta International of College Technical Education
Submitted by:
Riddhi Chouhan
ACKNOWLEDGEMENT
I am Riddhi Chouhan Student of Bachelor’s of computer application
Aryabhatta International College Of Technical Education would like to
express my gratitude to each and every person who has contributed in
stimulating suggestions and encouragement which really helped me to
co-ordinate my project.
I also thank Aryabhatta International College Of Technical Education who
provided insight and expertise that greatly assisted the project. Also, a
special thanks to my teacher, parents and colleagues who have supported me
at every step.
Not to forget, the almighty who blessed me with good health becauseof
which I worked more I worked more efficiently and better
TIC TAC TOE Game :
Start Game:
Win Game:
Draw Game:
Code:
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
char square[10] = {'o','1','2','3','4','5','6','7','8','9'};
int checkwin();
void board();
int main()
{
clrscr();
int player = 1,i,choice;
char mark;
do
{
board();
player=(player%2)?1:2;
gotoxy(10,20);
cout << "Player " << player << ", enter a number: ";
cin >> choice;
mark=(player == 1) ?'X' : '0';
if (choice == 1 && square[1] == '1')
square[1] = mark;
else if (choice == 2 && square[2] == '2')
square[2] = mark;
else if (choice == 3 && square[3] == '3')
square[3] = mark;
else if (choice == 4 && square[4] == '4')
square[4] = mark;
else if (choice == 5 && square[5] == '5')
square[5] = mark;
else if (choice == 6 && square[6] == '6')
square[6] = mark;
else if (choice == 7 && square[7] == '7')
square[7] = mark;
else if (choice == 8 && square[8] == '8')
square[8] = mark;
else if (choice == 9 && square[9] == '9')
square[9] = mark;
else
{
cout<<"Invalid move ";
player--;
cin.ignore();
cin.get();
}
i=checkwin();
player++;
}while(i==-1);
board();
if(i==1)
{
gotoxy(35,24);
cout<<"==>aPlayer "<<--player<<" win ";
}
else
{
gotoxy(35,24);
cout<<"==>aGame draw";
}
cin.ignore();
cin.get();
return 0;
}
int checkwin()
{
clrscr();
if (square[1] == square[2] && square[2] == square[3])
return 1;
else if (square[4] == square[5] && square[5] == square[6])
return 1;
else if (square[7] == square[8] && square[8] == square[9])
return 1;
else if (square[1] == square[4] && square[4] == square[7])
return 1;
else if (square[2] == square[5] && square[5] == square[8])
return 1;
else if (square[3] == square[6] && square[6] == square[9])
return 1;
else if (square[1] == square[5] && square[5] == square[9])
return 1;
else if (square[3] == square[5] && square[5] == square[7])
return 1;
else if (square[1] != '1' && square[2] != '2' && square[3] != '3'
&& square[4] != '4' && square[5] != '5' && square[6] != '6'
&& square[7] != '7' && square[8] != '8' && square[9] != '9')
return 0;
else
return -1;
}
void board()
{
int i;
clrscr();
gotoxy(36,5);
cout << "Tic Tac Toenn";
gotoxy(27,7);
cout << "Player 1 (X) - Player 2 (O)";
gotoxy(33,10);
cout << " " << square[1] << " | " << square[2] << " | " << square[3] << endl;
gotoxy(33,13);
cout << " " << square[4] << " | " << square[5] << " | " << square[6] << endl;
gotoxy(33,16);
cout << " " << square[7] << " | " << square[8] << " | " << square[9] << endl;
gotoxy(33,11);
for(i=0;i<=17;i++)
{
cprintf("%c",220);
}
gotoxy(33,14);
for(i=0;i<=17;i++)
{
cprintf("%c",220);
}
gotoxy(33,8);
for(i=0;i<=17;i++)
{
cprintf("%c",220);
}
gotoxy(33,17);
for(i=0;i<=17;i++)
{
cprintf("%c",220);
}
for(i=9;i<=17;i++)
{
gotoxy(32,i);
cprintf("%c",219);
}
for(i=9;i<=17;i++)
{
gotoxy(50,i);
cprintf("%c",219);
}
for(i=9;i<=17;i++)
{
gotoxy(38,i);
cprintf("%c",219);
}
for(i=9;i<=17;i++)
{
gotoxy(44,i);
cprintf("%c",219);
}
gotoxy(50,8);
cprintf("%c",220);
gotoxy(32,8);
cprintf("%c",220);
}
Thank you
Created By :-Riddhi Chouhan
Aryabhatta International College of Technical
Education

More Related Content

Similar to Tik tic tok

Tic tac toe on c++ project
Tic tac toe on c++ projectTic tac toe on c++ project
Tic tac toe on c++ project
Utkarsh Aggarwal
 
c++ project
c++ projectc++ project
c++ project
Trish004
 
Hardik Jadam , BCA Third Year
Hardik Jadam , BCA Third YearHardik Jadam , BCA Third Year
Hardik Jadam , BCA Third Year
Dezyneecole
 
Pooja Sharma , BCA Third Year
Pooja Sharma , BCA Third YearPooja Sharma , BCA Third Year
Pooja Sharma , BCA Third Year
Dezyneecole
 
SALARY MANAGEMENT SYSTEM IN C++
SALARY MANAGEMENT SYSTEM IN C++SALARY MANAGEMENT SYSTEM IN C++
SALARY MANAGEMENT SYSTEM IN C++
vikram mahendra
 
Cs pritical file
Cs pritical fileCs pritical file
Cs pritical file
Mitul Patel
 
Game programming-help
Game programming-helpGame programming-help
Game programming-help
Steve Nash
 
Shikh Mohammad Usman Haidar , BCA Third Year
Shikh Mohammad Usman Haidar , BCA Third YearShikh Mohammad Usman Haidar , BCA Third Year
Shikh Mohammad Usman Haidar , BCA Third Year
Dezyneecole
 
CANTEEN MANAGEMENT SYSTEM IN C++
CANTEEN MANAGEMENT SYSTEM IN C++CANTEEN MANAGEMENT SYSTEM IN C++
CANTEEN MANAGEMENT SYSTEM IN C++
vikram mahendra
 
Vinita Vaishnav , BCA Third Year
Vinita Vaishnav , BCA Third YearVinita Vaishnav , BCA Third Year
Vinita Vaishnav , BCA Third Year
Dezyneecole
 
Hardik Jadam , BCA Third Year
Hardik Jadam , BCA Third YearHardik Jadam , BCA Third Year
Hardik Jadam , BCA Third Year
Dezyneecole
 
ANS#include iostream int Rn_get(int low, int high); int cva.pdf
ANS#include iostream int Rn_get(int low, int high); int cva.pdfANS#include iostream int Rn_get(int low, int high); int cva.pdf
ANS#include iostream int Rn_get(int low, int high); int cva.pdf
anikkothari1
 
New Tools for a More Functional C++
New Tools for a More Functional C++New Tools for a More Functional C++
New Tools for a More Functional C++
Sumant Tambe
 
Gaurav Jatav , BCA Third Year
Gaurav Jatav , BCA Third YearGaurav Jatav , BCA Third Year
Gaurav Jatav , BCA Third Year
dezyneecole
 
The main class of the tictoe game looks like.public class Main {.pdf
The main class of the tictoe game looks like.public class Main {.pdfThe main class of the tictoe game looks like.public class Main {.pdf
The main class of the tictoe game looks like.public class Main {.pdf
asif1401
 
Shivani Chouhan , BCA Third Year
Shivani Chouhan , BCA Third YearShivani Chouhan , BCA Third Year
Shivani Chouhan , BCA Third Year
Dezyneecole
 
COMPUTER SCIENCE INVESTIGATORY PROJECT ON FOOTBALL GAME AND SCORE MANAGEMENT ...
COMPUTER SCIENCE INVESTIGATORY PROJECT ON FOOTBALL GAME AND SCORE MANAGEMENT ...COMPUTER SCIENCE INVESTIGATORY PROJECT ON FOOTBALL GAME AND SCORE MANAGEMENT ...
COMPUTER SCIENCE INVESTIGATORY PROJECT ON FOOTBALL GAME AND SCORE MANAGEMENT ...
pankajkumbara
 
include ltstdiohgt include ltstdlibhgt include .pdf
include ltstdiohgt include ltstdlibhgt include .pdfinclude ltstdiohgt include ltstdlibhgt include .pdf
include ltstdiohgt include ltstdlibhgt include .pdf
adisainternational
 
Online exam
Online examOnline exam
Online exam
HarshitaBhargava4
 
Tic tac toe
Tic tac toeTic tac toe
Tic tac toe
HarshitaBhargava4
 

Similar to Tik tic tok (20)

Tic tac toe on c++ project
Tic tac toe on c++ projectTic tac toe on c++ project
Tic tac toe on c++ project
 
c++ project
c++ projectc++ project
c++ project
 
Hardik Jadam , BCA Third Year
Hardik Jadam , BCA Third YearHardik Jadam , BCA Third Year
Hardik Jadam , BCA Third Year
 
Pooja Sharma , BCA Third Year
Pooja Sharma , BCA Third YearPooja Sharma , BCA Third Year
Pooja Sharma , BCA Third Year
 
SALARY MANAGEMENT SYSTEM IN C++
SALARY MANAGEMENT SYSTEM IN C++SALARY MANAGEMENT SYSTEM IN C++
SALARY MANAGEMENT SYSTEM IN C++
 
Cs pritical file
Cs pritical fileCs pritical file
Cs pritical file
 
Game programming-help
Game programming-helpGame programming-help
Game programming-help
 
Shikh Mohammad Usman Haidar , BCA Third Year
Shikh Mohammad Usman Haidar , BCA Third YearShikh Mohammad Usman Haidar , BCA Third Year
Shikh Mohammad Usman Haidar , BCA Third Year
 
CANTEEN MANAGEMENT SYSTEM IN C++
CANTEEN MANAGEMENT SYSTEM IN C++CANTEEN MANAGEMENT SYSTEM IN C++
CANTEEN MANAGEMENT SYSTEM IN C++
 
Vinita Vaishnav , BCA Third Year
Vinita Vaishnav , BCA Third YearVinita Vaishnav , BCA Third Year
Vinita Vaishnav , BCA Third Year
 
Hardik Jadam , BCA Third Year
Hardik Jadam , BCA Third YearHardik Jadam , BCA Third Year
Hardik Jadam , BCA Third Year
 
ANS#include iostream int Rn_get(int low, int high); int cva.pdf
ANS#include iostream int Rn_get(int low, int high); int cva.pdfANS#include iostream int Rn_get(int low, int high); int cva.pdf
ANS#include iostream int Rn_get(int low, int high); int cva.pdf
 
New Tools for a More Functional C++
New Tools for a More Functional C++New Tools for a More Functional C++
New Tools for a More Functional C++
 
Gaurav Jatav , BCA Third Year
Gaurav Jatav , BCA Third YearGaurav Jatav , BCA Third Year
Gaurav Jatav , BCA Third Year
 
The main class of the tictoe game looks like.public class Main {.pdf
The main class of the tictoe game looks like.public class Main {.pdfThe main class of the tictoe game looks like.public class Main {.pdf
The main class of the tictoe game looks like.public class Main {.pdf
 
Shivani Chouhan , BCA Third Year
Shivani Chouhan , BCA Third YearShivani Chouhan , BCA Third Year
Shivani Chouhan , BCA Third Year
 
COMPUTER SCIENCE INVESTIGATORY PROJECT ON FOOTBALL GAME AND SCORE MANAGEMENT ...
COMPUTER SCIENCE INVESTIGATORY PROJECT ON FOOTBALL GAME AND SCORE MANAGEMENT ...COMPUTER SCIENCE INVESTIGATORY PROJECT ON FOOTBALL GAME AND SCORE MANAGEMENT ...
COMPUTER SCIENCE INVESTIGATORY PROJECT ON FOOTBALL GAME AND SCORE MANAGEMENT ...
 
include ltstdiohgt include ltstdlibhgt include .pdf
include ltstdiohgt include ltstdlibhgt include .pdfinclude ltstdiohgt include ltstdlibhgt include .pdf
include ltstdiohgt include ltstdlibhgt include .pdf
 
Online exam
Online examOnline exam
Online exam
 
Tic tac toe
Tic tac toeTic tac toe
Tic tac toe
 

Recently uploaded

Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi ArabiaTop 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Yara Milbes
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
ShamsuddeenMuhammadA
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 

Recently uploaded (20)

Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi ArabiaTop 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 

Tik tic tok

  • 1. Aryabhatta International College of Technical Education Ajmer, Rajasthan A PROJECT REPORT ON TIC TAC TOE Game: C++ Submitted in partial fulfilment for Award of the Degree of 2017 Year, BACHELOR OF COMPUTER APPLICATION Submitted to Aryabhatta International of College Technical Education Submitted by: Riddhi Chouhan
  • 2. ACKNOWLEDGEMENT I am Riddhi Chouhan Student of Bachelor’s of computer application Aryabhatta International College Of Technical Education would like to express my gratitude to each and every person who has contributed in stimulating suggestions and encouragement which really helped me to co-ordinate my project. I also thank Aryabhatta International College Of Technical Education who provided insight and expertise that greatly assisted the project. Also, a special thanks to my teacher, parents and colleagues who have supported me at every step. Not to forget, the almighty who blessed me with good health becauseof which I worked more I worked more efficiently and better
  • 3. TIC TAC TOE Game : Start Game: Win Game:
  • 4. Draw Game: Code: #include<iostream.h> #include<conio.h> #include<stdlib.h> char square[10] = {'o','1','2','3','4','5','6','7','8','9'}; int checkwin(); void board(); int main() { clrscr(); int player = 1,i,choice; char mark; do { board(); player=(player%2)?1:2;
  • 5. gotoxy(10,20); cout << "Player " << player << ", enter a number: "; cin >> choice; mark=(player == 1) ?'X' : '0'; if (choice == 1 && square[1] == '1') square[1] = mark; else if (choice == 2 && square[2] == '2') square[2] = mark; else if (choice == 3 && square[3] == '3') square[3] = mark; else if (choice == 4 && square[4] == '4') square[4] = mark; else if (choice == 5 && square[5] == '5') square[5] = mark; else if (choice == 6 && square[6] == '6') square[6] = mark; else if (choice == 7 && square[7] == '7') square[7] = mark; else if (choice == 8 && square[8] == '8') square[8] = mark; else if (choice == 9 && square[9] == '9') square[9] = mark; else
  • 6. { cout<<"Invalid move "; player--; cin.ignore(); cin.get(); } i=checkwin(); player++; }while(i==-1); board(); if(i==1) { gotoxy(35,24); cout<<"==>aPlayer "<<--player<<" win "; } else { gotoxy(35,24); cout<<"==>aGame draw"; } cin.ignore(); cin.get(); return 0; } int checkwin() { clrscr(); if (square[1] == square[2] && square[2] == square[3])
  • 7. return 1; else if (square[4] == square[5] && square[5] == square[6]) return 1; else if (square[7] == square[8] && square[8] == square[9]) return 1; else if (square[1] == square[4] && square[4] == square[7]) return 1; else if (square[2] == square[5] && square[5] == square[8]) return 1; else if (square[3] == square[6] && square[6] == square[9]) return 1; else if (square[1] == square[5] && square[5] == square[9]) return 1; else if (square[3] == square[5] && square[5] == square[7]) return 1; else if (square[1] != '1' && square[2] != '2' && square[3] != '3' && square[4] != '4' && square[5] != '5' && square[6] != '6' && square[7] != '7' && square[8] != '8' && square[9] != '9') return 0; else return -1; } void board() {
  • 8. int i; clrscr(); gotoxy(36,5); cout << "Tic Tac Toenn"; gotoxy(27,7); cout << "Player 1 (X) - Player 2 (O)"; gotoxy(33,10); cout << " " << square[1] << " | " << square[2] << " | " << square[3] << endl; gotoxy(33,13); cout << " " << square[4] << " | " << square[5] << " | " << square[6] << endl; gotoxy(33,16); cout << " " << square[7] << " | " << square[8] << " | " << square[9] << endl; gotoxy(33,11); for(i=0;i<=17;i++) { cprintf("%c",220); } gotoxy(33,14); for(i=0;i<=17;i++) { cprintf("%c",220); } gotoxy(33,8); for(i=0;i<=17;i++) { cprintf("%c",220); } gotoxy(33,17); for(i=0;i<=17;i++) {
  • 10. Thank you Created By :-Riddhi Chouhan Aryabhatta International College of Technical Education