Own free website with 1 GB free space?
 


IN 1903 , as the first powered human flight swept the OHIO sky, Wilbur and orville Wright redefinr=ed human capabilities to shrink the world.even after 9 decades ,the idea invogorates our value system and inspires us to put the world at our arm distance.this proactive approach of our enterprise solutions led m@de4u.page.tl ,the only website provisioning ability by youngsters ,on a multitude of internet based services. Hope ull surely enjoy stay on the website! A WARM WELCOME TO ALL U GUYS , THIS IS SHASHANKK 4M SVIT. THIS WEBSITE I SOLELEY INTENDED FOR GUYS 4M ALL YEARS TO HAVE THEIR SOURCE 4 LEARNING, BUT I HAVE STARTED MINE JOB WITH ITSELF FIRST YEAR GUYS, SO DO NAVIGATE THEM THEY MIGHT BE USEFUL TO U!!!







only search google.com




THIS IS SPECIALLY DESIGNED BY SHASHANKK JUST4U ,SO ENJOY YOUR STAY ON THIS WEBSITE AND REAP MAXIMUM BENIFITS OF IT

*


Today, there have been 9 visits (87 hits) on this page! //-->

made 4 u . COM

TIC TAC TOE

#include
#include
void Board();
void PlayerX();
void PlayerO();
void Player_win();
void check();
int win=0,wrong_X=0,wrong_O=0,chk=0;

char name_X[30];
char name_O[30];
int pos_for_X[3][3];
int pos_for_O[3][3];
int pos_marked[3][3];
void main()
{ int i,ch,j;
char ans;
/* clrscr();
printf("nttttTIC TAC TOE");
printf("ntttt");
for(i=1;i<=11;i++) {
delay(100);
printf("*");
}*/ do
{ clrscr();
printf("nttttTIC TAC TOE");
printf("ntttt");
for(i=1;i<=11;i++) {
delay(100);
printf("*");
} printf("n1.Start The Game");
printf("n2.Quit The Game");
printf("nEnter your choice(1-2) : ");
scanf("%d",&ch);
switch(ch)
{ case 1:
chk=0;
win=0;
for(i=1;i<=3;i++)
{ for(j=1;j<=3;j++)
{ pos_for_X[i][j]=0;
pos_for_O[i][j]=0;
pos_marked[i][j]=0;

} } printf("nn");
clrscr();
printf("nEnter the name of the player playing for 'X': "); fflush(stdin);
gets(name_X);
printf("nEnter the name of the player playing for 'O': "); fflush(stdin);
gets(name_O);

Board();
for(;;)
{ if(win==1)
break;
check();
if(chk==9)
{ printf("ntttMATCH DRAWS!!");
printf("nPress any key....");
break;
} else chk=0;
printf("nTURN FOR %s:",name_X);
PlayerX();
do { if(wrong_X!=1)
break;
wrong_X=0;
printf("nTURN FOR %s:",name_X);
PlayerX();
}while(wrong_X==1);
check();
if(chk==9)
{ printf("ntttMATCH DRAWS");
printf("nPress any key....");
break;
}
else chk=0; printf("nTURN FOR %s:",name_O); PlayerO()
; do { if(wrong_O!=1)
break;v wrong_O=0;
printf("nTURN FOR %s:",name_O);
PlayerO();
}while(wrong_O==1);
} Board();
if(win!=1)
{ printf("ntttMATCH DRAWS!!");
printf("nPress any key.......");
} getch();
break;
case 2: printf("nnntttThank You For Playing The Game.");
printf("nttt###############################");
getch();
exit(1);
break;
} printf("nWant To Play(Y/N) ? ");
fflush(stdin);
scanf("%c",&ans);
}while(ans=='y' || ans=='Y');
} void Board() { int i,j;
clrscr();
printf("nttttTIC TAC TOE BOARD");
printf("ntttt*****************");
printf("nnn"); printf("nttt 1t 2t 3");
for(i=1;i<=3;i++) { printf("n ttt _____________________________");
printf("n tttēt ēt ēt ē");
printf("ntt%dt",i);
for(j=1;j<=3;j++) { if(pos_for_X[i][j]==1)
{ printf(" X");
printf(" ");
}
else if(pos_for_O[i][j]==1) { printf(" O");
printf(" ");
} else { printf(" ");
continue;
} } printf("ntttēt ēt ēt ē");
} printf("nttt------------------------------");
Player_win();
} void PlayerX()
{ int row,col;
if(win==1)
return;
printf("nEnter the row no. : ");
scanf("%d",&row); printf("Enter the column no. : ");
scanf("%d",&col); if(pos_marked[row][col]==1 || row<1 || row>3 || col<1 || col>3) { printf("nWRONG POSITION!! Press any key.....");
wrong_X=1;
getch();
Board();
} else { pos_for_X[row][col]=1;
pos_marked[row][col]=1;
Board(); } } void PlayerO()
{ int row,col;
if(win==1)
return;
printf("nEnter the row no. : ");
scanf("%d",&row);
printf("Enter the column no. : ");
scanf("%d",&col);
if(pos_marked[row][col]==1 || row<1 || row>3 || col<1 || col>3)
{ printf("nWRONG POSITION!! Press any key....");
wrong_O=1;
getch();
Board();
} else { pos_for_O[row][col]=1;
pos_marked[row][col]=1;
Board();
} } void Player_win()
{ int i; for(i=1;i<=3;i++)
{ if(pos_for_X[i][1]==1 && pos_for_X[i][2]==1 && pos_for_X[i][3]==1)
{ win=1; printf("nnRESULT: %s wins!!",name_X);
printf("nPress any key............");
return;
} } for(i=1;i<=3;i++)
{ if(pos_for_X[1][i]==1 && pos_for_X[2][i]==1 && pos_for_X[3][i]==1)
{ win=1; printf("nnRESULT: %s wins!!",name_X);
printf("nPress any key............");
return;
} } if(pos_for_X[1][1]==1 && pos_for_X[2][2]==1 && pos_for_X[3][3]==1) { win=1;
printf("nnRESULTL: %s wins!!",name_X);
printf("nPress any key......");
return;
}
else if(pos_for_X[1][3]==1 && pos_for_X[2][2]==1 && pos_for_X[3][1]==1)
{
win=1;
printf("nnRESULT: %s wins!!",name_X);
printf("nPress any key.....");
return;
} for(i=1;i<=3;i++)
{ if(pos_for_O[i][1]==1 && pos_for_O[i][2]==1 && pos_for_O[i][3]==1) { win=1;
printf("nnRESULT: %s wins!!",name_O);
printf("nPress any key.....");
return;
} } for(i=1;i<=3;i++)
{ if(pos_for_O[1][i]==1 && pos_for_O[2][i]==1 && pos_for_O[3][i]==1)
{ win=1;
printf("nnRESULT: %s wins!!",name_O);
printf("nPress any key.....");
return;
} } if(pos_for_O[1][1]==1 && pos_for_O[2][2]==1 && pos_for_O[3][3]==1)
{ win=1; printf("nnRESULT: %s wins!!",name_O);
printf("nPress any key.....");

return;
} else if(pos_for_O[1][3]==1 && pos_for_O[2][2]==1 && pos_for_O[3][1]==1)
{ win=1; printf("nnRESULT: %s wins!!",name_O);
v printf("nPress any key.....");
return;
} } void check()
{ int i,j;
for(i=1;i<=3;i++)
{ for(j=1;j<=3;j++)
{ if(pos_marked[i][j]==1) chk++;
else
continue;
} } }
 
This website was created for free with Own-Free-Website.com. Would you also like to have your own website?
Sign up for free