#include //required files #include #include #include #include #define MAX_SCORE 300 #define MAX_RANGE 10 #define GUTTER_MAX 100 #define SND_FILENAME 0x20000 #define SND_ASYNC 1 using namespace std; main () { system("color 70"); system("title Text'o'Rama Bowling"); char highscore, name[20], instra; int frames=0; long pins; int spin, power, arrow, score, roll, total; int BASE, framescore, divy, divider, pinsleft; int n; int gutterball; int tries; pins=10; tries=0; total=0; framescore=0; char bowling[] = "C:\\Documents and Settings\\Administrator\\My Documents\\Programs\\Fun Programs\\Bowling\\bowling.wav"; char gutterwav[] = "F:\\Programming\\Fun Programs\\Bowling\\gutterball.wav"; char hooray[] = "F:\\Programming\\Fun Programs\\Bowling\\cheer.wav"; cout<<" Welcome to Shawn Biddle's Text'o'Rama Bowling\n"; cout<<"Please enter your name for the highscore list:"; cin>> name; cout<<"Would you like to see the instructions?[Y][N]"<< endl; cin>> instra; if (instra=='y'){ cout<<"The objective is simple, Knock down the pins."; cout<<"Choose Your power,and alignment.\nPower being fairly obvious."; cout<<" Finally your alignment being the marker on the lane you line up your bowler with.\n"; system("PAUSE"); goto begin;} else { begin: do{ newframe: system("cls"); frames++; cout<<" *****NEW FRAME*****\n"; roll+total; framestart: tries++; if (tries==1){framescore=0;} else if (tries>1){framescore=roll;} if (tries==3){tries=0;goto newframe;} score=total; pinsleft=pins-framescore; align: if (pinsleft==1){ cout<<" ______________________\n"; cout<<" \\ SCORE:"<> arrow; if (arrow<0 || arrow>5){cout<<"Please enter a number between 1 and 5.\n"; system("PAUSE");goto align;} power: cout<<" Power (1-10):\n"; cin>> power; if (power<0 || power>10){cout<<"Please enter a number between 1 and 10.\n"; system("PAUSE");system("cls");goto power;} srand ( time (NULL) ); divy=pins-roll; pinsleft=10; if (tries==2){roll = rand()%divy+1;} gutterball = rand()%GUTTER_MAX+1; if (tries<2) {roll = rand()%MAX_RANGE+1;} if (gutterball<10){roll=0;} if (arrow==3 && roll>0){ for (int n=5; n>1; n--) { cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | |^ _ ^| |\n"; cout<<" | |1 ^ / \\ ^ 5| |\n"; cout<<" | | 2 \\_/ 4 | |\n"; cout<<" ---------------------\n"; system("cls");} for (int n=5; n>1; n--) { cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | _ | |\n"; cout<<" | |^ / \\ ^| |\n"; cout<<" | |1 ^ \\_/ ^ 5| |\n"; system("cls");} for (int n=5; n>1; n--) { cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | _ | |\n"; cout<<" | | / \\ | |\n"; cout<<" | |^ \\_/ ^| |\n"; system("cls");} for (int n=10; n>1; n--) { cout<<" | | 2 3 4 | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | _ | |\n"; cout<<" | | / \\ | |\n"; cout<<" | | \\_/ | |\n"; system("cls");} for (int n=10; n>1; n--) { cout<<" | |1 ^ ^ ^ 5| |\n"; cout<<" | | 2 3 4 | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | _ | |\n"; cout<<" | | / \\ | |\n"; cout<<" | | \\_/ | |\n"; system("cls");} for (int n=10; n>1; n--) { cout<<" | |^ ^| |\n"; cout<<" | |1 ^ ^ ^ 5| |\n"; cout<<" | | 2 3 4 | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | _ | |\n"; cout<<" | | / \\ | |\n"; cout<<" | | \\_/ | |\n"; system("cls");} for (int n=10; n>1; n--) { cout<<" | | | |\n"; cout<<" | |^ ^| |\n"; cout<<" | |1 ^ ^ ^ 5| |\n"; cout<<" | | 2 3 4 | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | _ | |\n"; cout<<" | | / \\ | |\n"; cout<<" | | \\_/ | |\n"; system("cls");} for (int n=10; n>1; n--) { cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | |^ ^| |\n"; cout<<" | |1 ^ ^ ^ 5| |\n"; cout<<" | | 2 3 4 | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | _ | |\n"; cout<<" | | / \\ | |\n"; cout<<" | | \\_/ | |\n"; system("cls");} for (int n=10; n>1; n--) { cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | |^ ^| |\n"; cout<<" | |1 ^ ^ ^ 5| |\n"; cout<<" | | 2 3 4 | |\n"; cout<<" | | | |\n"; cout<<" | | _ | |\n"; cout<<" | | / \\ | |\n"; cout<<" | | \\_/ | |\n"; system("cls");} for (int n=10; n>1; n--) { cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | |^ ^| |\n"; cout<<" | |1 ^ ^ ^ 5| |\n"; cout<<" | | 2 3 4 | |\n"; cout<<" | | _ | |\n"; cout<<" | | / \\ | |\n"; cout<<" | | \\_/ | |\n"; system("cls");} for (int n=10; n>1; n--) { cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | |^ ^| |\n"; cout<<" | |1 ^ ^ ^ 5| |\n"; cout<<" | | 2 3 4 | |\n"; cout<<" | | / \\ | |\n"; cout<<" | | \\_/ | |\n"; system("cls");} for (int n=10; n>1; n--) { cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | | | |\n"; cout<<" | |^ ^| |\n"; cout<<" | |1 ^ _ ^ 5| |\n"; cout<<" | | 2 / \\3 | |\n"; cout<<" | | \\_/ | |\n"; cout<<" | | | |\n"; system("cls");}} if (roll>0){PlaySound(bowling,NULL,SND_FILENAME|SND_LOOP|SND_ASYNC);getchar();} if (roll==0){PlaySound(gutterwav,NULL,SND_FILENAME|SND_LOOP|SND_ASYNC); cout<<" *CRASH* *THUMP* GUTTERBALL!\n";} if (roll==10){PlaySound(hooray,NULL,SND_FILENAME|SND_LOOP|SND_ASYNC); cout<<" STEEEEEEEEERIKE!\n";} else if (roll>0 && roll<6 && tries<2){ cout<<" Well Atleast You Hit Something.\n";} else if (roll>6){ cout<<" Good Roll!\n";} cout<<" You knocked down "<< roll <<"\n"; total=score+roll; cout<<" Your score is "<< total <<" in frame "<> highscore; if (highscore=='y'){ system("cls"); char buffer[200]; ifstream examplefile ("highscore.txt"); if (! examplefile.is_open()) { cout << "Error opening file"; exit (1); } while (! examplefile.eof() ){ examplefile.getline (buffer,100); cout << buffer <