#include
#include
#include
#include
#include
int us,cs,flag=0;
void bat();
void bowl();
void cbat();
void cbowl();
void main()
{
start :
textcolor(3);
us=cs=flag=0;
clrscr();
char toss,name[30];
int rand;
randomize();
cout<<"\n\n\t\tHand Cricket.....\n\n\n\tTOSS\n\t\n\nHead Or Tail \n\nEnter H / T : ";
toss=toupper(getch());
if((toss!='H')&&(toss!='T'))
{
cout<<"\a\n\nEnter H Or T : ";
delay(1000);
goto start;
}
cout< int i=1; while(!kbhit()) { rand=random(2); switch(rand) { case 0 : cout<<" Head ";break; case 1 : cout<<" Tail ";break; } if((i%11)==0) cout<<'\n'; delay(50); i++; } getch(); redo : switch(rand) { case 0 : if(toss=='H') { cout<<"\nYou Won The Toss !!\n\n\nBatting Or Bowling ? \n\nEnter B / L : "; toss=toupper(getch()); cout< if(toss=='B') bat(); else if(toss=='L') bowl(); else { cout<<"\n\nPlease Enter Correct Option : "; sound(700); delay(750); nosound(); toss='H'; goto redo; } } else if(toss=='T') { cout<<"\n\nComputer Wins The Toss !! \n\n"; switch(rand) { case 0 : cout<<"\n\nComputer Choose To Bat ! "; getch(); bowl(); break; case 1 : cout<<"\n\nComputer Choose To Bowl ! "; getch(); bat(); break; } }break; case 1 : if(toss=='T') { cout<<"\nYou Won The Toss !!\n\n\nBatting Or Bowling ? \n\nEnter B / L : "; toss=toupper(getch()); cout< if(toss=='B') bat(); else if(toss=='L') bowl(); else { cout<<"\n\nPlease Enter Correct Option : "; sound(700); delay(750); nosound(); toss='H'; goto redo; } } else if(toss=='H') { cout<<"\n\nComputer Wins The Toss !! \n\n"; switch(rand) { case 0 : cout<<"\n\nComputer Choose To Bat ! "; getch(); bowl(); break; case 1 : cout<<"\n\nComputer Choose To Bowl ! "; getch(); bat(); break; } }break; } if(us>cs) { cout<<"\n\n\t\t\t***You Win !! ***"; } else if(cs>us) { cout<<"\n\n\t\t\t***Computer Win !! ***"; } else { cout<<"\n\n\t\t\t***Match TIED"; } cout<<"\n\nDo You Want To Play Again ? \n\nEnter Y / N : "; toss=toupper(getch()); cout< if(toss=='N') { cout<<"\n\nThankYou For Playing This Game !!"; delay(2000); } else goto start; getch(); } void bat() { textcolor(5); clrscr(); randomize(); cout<<"\n\n\n\nUser Batting !\n\n"; int u,c; do { if(flag!=0) { if((cs-us)<0) { cout<<"\n\n\nYou Win !!"; goto end; } cout<<"\n\nYou Need "<<(cs-us)<<" Runs To Win ! "; } cout<<"\n\nEnter Shot 1 to 4 and 6 : "; u=getche(); u-=48; if((u>6)(u==0)(u==5)) { cout<<"\aInvalid Shot ! "; continue; } c=random(5); switch(c) { case 0 : c=1 ;break; case 1 : c=2 ;break; case 2 : c=3 ;break; case 3 : c=4 ;break; case 4 : c=6 ;break; } if(u!=c) { us+=u; cout<<"\nYou Win "< } else { cout<<"\n\nYou Are OUT \n\nYou Have "< } }while(u!=c); getch(); if(flag==0) { flag=1; bowl(); } end : } void bowl() { textcolor(2); clrscr(); randomize(); int u,c; cout<<"\n\n\n\nUser Bowling !\n\n"; do { if(flag!=0) { if((us-cs)<0) { cout<<"\n\n\nComputer Wins !! "; goto end; } cout<<"\n\nComputer Needs "<<(us-cs)<<" Runs To Win ! \n\n"; } cout<<"\n\nEnter Style 1 to 4 and 6 : "; u=getche(); u-=48; if((u>6)(u==0)(u==5)) { cout<<"\aInvalid Style ! "; continue; } c=random(5); switch(c) { case 0 : c=1 ;break; case 1 : c=2 ;break; case 2 : c=3 ;break; case 3 : c=4 ;break; case 4 : c=6 ;break; } if(u!=c) { //cout< cs+=c; cout<<"\nComputer Win "< } else { cout<<"\n\nYou Have Bowled Out The Computer \n\nComputer Have "< } }while(u!=c); getch(); if(flag==0) { flag=1; bat(); } end: }
d a tool for analysing c plus plus program
Every C plus plus program that is a main program must have the function 'main'.
example output of c++ calculator
it is a step by step program written in simple English for our understanding
how to write a program that counts automorphic number from 1 to 999
A C++ game project program could either be a game written in C++ or a C++ library that helps you develop a game.
yes! why not! this c program is used in ATM servicesand also in games.
Yes, you can program games with C++.
Exit the program and relaunch it.
d a tool for analysing c plus plus program
By learning how to program on C+.
C++ is an extension of C, and was invented by Bjarne Stroustrup.
Every C plus plus program that is a main program must have the function 'main'.
Yes, you can rewrite a cuda program originally written in c in c plus plus.
example output of c++ calculator
Game of cricket has been started in the year of 16th century and from 1844 various international cricket matches were played and in 1877 official history of international test cricket begin.
They are bosom-friends.