/* Title TicTacToe Game Author Harsh Author Email harsh_sahajwani [at] indiatimes.com Description This is a tictactoe game in C++. Although it is not too smart to prevent you from winning but it is worth playing it. I hope u enjoy it. Happy gaming! Category C++ » Games Hits 1988 */ Code : #include //opening headerfile iostream for in-out #include //opening headerfile conio for clrscr(); #include //opening headerfile stdlib for random(int); char tic[3][3]; //global matrix declerations int d,e,f,a,t,i,j,x,y; //global variables declerations void display(); //displays the matrix void user(); //function for user's move void newdisp(); //function for display of matrix after every move void pc(); //function for pc's move int check(); //function for finding out the winner int horcheck(); //function for horizontal line check int vercheck(); //function for vertical line check int diagcheck(); //function for diagonal line check main() //main function { clrscr(); //clears the previous output screen randomize(); //initialize random function calling int d=random(2); //random function call for(i=0;i<3;i++) for(j=0;j<3;j++) tic[i][j]=' '; //assigning space ' ' to all elements of matrix display(); //display function call d==0?user():pc(); //random starting of the game depending on d getch(); //provides output by getting input without returning to program return 0; //return int to main function } void display() //display function definition { for(t=0;t<3;t++) { cout<<" "<>x>>y; if((x<0)||(x>2)&&(y<0)||(y>2)) //check for valid co-ordinates { cout<<" ENTER THE CORRECT CO-ORDINATES"; user(); //user function call } else { if(tic[x][y]==' ') //check for vacant space at entered co-ordinates { tic[x][y]='X'; //assigning user 'X' to the co-ordinates newdisp(); //newdisp function call } else { cout<<" THIS POSITION IS ALREADY FILLED. CHOOSE SOME OTHER CO-ORDINATES"; user(); //user function call } } d=check(); //check function call if(d==0) pc(); //pc function call else { cout<<" YOU ARE THE WINNER"; getche(); //requires enter to return to program. prevents return without display exit(1); //program termination } } void newdisp() //newdisp function definition { for(t=0;t<3;t++) { cout<<" "<