1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
|
#include <iostream>
#include <string>
using namespace std;
int main ()
{
int f1b1 f1b2 f2b1 f2b2 f3b1 f3b2 f4b1 f4b2 f5b1 f5b2 f6b1 f6b2 f7b1 f7b2 f8b1 f8b2 f9b1 f9b2 f10b1 f10b2 f10b3
cout << "Welcome to the bowling program, please enter your name: " << endl;
cin >> name;
cout << "Okay, " << name << "please enter ball 1 of frame 1: " << endl;
cin >> f1b1;
if (f1b1 > 10)
{
cout << "Sorry, that number is incorrect. Please enter your real score" << endl;
cin >> f1b1;
}
else
{
cout << "Great. Please enter ball 2 of frame 1: " << endl;
cin >> f1b2;
}
if (f1b1 == 10)
{
f1b2 == 0
cout << "Strike. Your current score is 10. Please enter ball 1 of frame 2: " endl;
cin >> f2b1;
}
if (f1b1 + f1b2 > 10)
{
cout << "Sorry, that combination is incorrect. Please enter your real score: " << endl;
cin >> f1b2;
}
else
{
cout << "Your current score is " << f1b1 + f1b2 << ", please enter ball 1 of frame 2: " << endl;
cin >> f2b1;
}
if (f1b1 + f1b2 == 10)
{
cout << "Spare. Your current score is 10, please enter ball 1 of frame 2: " << endl;
cin >> f2b1;
}
if (f2b1 > 10)
{
cout << "Sorry, that number is incorrect. Please enter your real score" << endl;
cin >> f2b1;
}
else
{
cout << "Great. Please enter ball 2 of frame 2: " << endl;
cin >> f2b2;
}
if (f2b1 == 10)
{
f2b2 == 0
cout << "Strike. Your current score is " << f1b1 + f1b2 + 10 << ". Please enter ball 1 of frame 2: " endl;
cin >> f3b1;
}
if (f2b1 + f2b2 > 10)
{
cout << "Sorry, that combination is incorrect. Please enter your real score: " << endl;
cin >> f2b2;
}
else
{
cout << "Your current score is " << f1b1 + f1b2 + f2b1 + f2b2 << ", please enter ball 1 of frame 3: " << endl;
cin >> f3b1;
}
if (f2b1 + f2b2 == 10)
{
cout << "Spare. Your current score is " << f1b1 + f1b2 + 10 << ", please enter ball 1 of frame 3: " << endl;
cin >> f3b1;
}
if (f3b1 > 10)
{
cout << "Sorry, that number is incorrect. Please enter your real score" << endl;
cin >> f3b1;
}
else
{
cout << "Great. Please enter ball 2 of frame 3: " << endl;
cin >> f3b2;
}
if (f3b1 == 10)
{
f3b2 == 0
cout << "Strike. Your current score is " << f1b1 + f1b2 + f2b1 + f2b2 + 10<< ". Please enter ball 1 of frame 2: " endl;
cin >> f4b1;
}
if (f2b1 + f2b2 > 10)
{
cout << "Sorry, that combination is incorrect. Please enter your real score: " << endl;
cin >> f3b2;
}
else
{
cout << "Your current score is " << f1b1 + f1b2 + f2b1 + f2b2 + f3b1 + f3b2 << ", please enter ball 1 of frame 3: " << endl;
cin >> f4b1;
}
if (f2b1 + f2b2 == 10)
{
cout << "Spare. Your current score is " << f1b1 + f1b2 + f2b1 + f2b2 + 10 << ", please enter ball 1 of frame 3: " << endl;
cin >> f4b1;
}
if (f4b1 > 10)
{
cout << "Sorry, that number is incorrect. Please enter your real score" << endl;
cin >> f4b1;
}
else
{
cout << "Great. Please enter ball 2 of frame 4: " << endl;
cin >> f4b2;
}
if (f4b1 == 10)
{
f4b2 == 0
cout << "Strike. Your current score is " << f1b1 + f1b2 + f2b1 + f2b2 + 10<< ". Please enter ball 1 of frame 5: " endl;
cin >> f4b1;
}
if (f4b1 + f4b2 > 10)
{
cout << "Sorry, that combination is incorrect. Please enter your real score: " << endl;
cin >> f1b2;
}
else
{
cout << "Your current score is " << f1b1 + f1b2 + f2b1 + f2b2 + f3b1 + f3b2 << ", please enter ball 1 of frame 4: " << endl;
cin >> f5b1;
}
if (f4b1 + f4b2 == 10)
{
cout << "Spare. Your current score is " << f1b1 + f1b2 + f2b1 + f2b2 + f3b1 + f3b2 + 10 << "Please enter ball 1 of frame 5" << endl;
cin >> f5b1;
}
system("pause>nul");
return 0;
}
|