### bowling score help

Alright y'all I'm not sure if I'm doing this correctly or not...so any help would be great. I also plan on implementing a do while loop I just haven't yet till I get the main code to work. Thank you in advance! Here is the question from my professor:

Write a C++ program that scores a game of bowling. A game of bowling has 10 frames. The
tenth frame works in a slightly different way than the first 9. For the first 9 frames, each will consist
of 1 or 2 rolls. You will be presented with 10 pins. If you hit all 10 pins in the first roll you make a
"strike", and the frame is over. Otherwise you have a second roll to hit the remaining pins. If you hit
all remaining pins you score a "spare";otherwise you have an "open frame". The number of points
an open frame gives is simply the total number of pins you hit. A spare gives 10 points plus the
number of pins hit on your next roll (in the next frame). A strike gives 10 points plus the number of
pins hit on the next two rolls (in thenext frame, or possibly the next two frames if you hit a strike in
the nextroll). The last frame consists of 2 or 3 rolls. The way it works is as follows:
6
● 10 pins are presented
● If you hit all 10 pins, you score a strike (10 points), and 10 pins are presentedagain:
○ If you hit all 10 pins again, you score a new strike, and 10 pins are presented
again, for the last time.
● If you hit 10 pins again, you score one more strike.
● If you hit fewer than 10 pins, you score that number of pins.
○ If you hit fewer than 10 pins, you score that number of points and theremaining
pins are presented.
● If you hit all remaining pins, you score a spare (10 points).
● If you hit fewer than that, you score that many pins.
● If you hit fewer than 10 pins on the first roll, the remaining pins are presented.
○ If you hit all remaining pins, you score a spare and 10 pins are presentedagain.
● If you hit all 10 pins on the third roll, you score a strike.
● If you hit fewer than 10 pins, you score as many points as pins hit.
○ If you hit fewer than the remaining pins, you score the number of pins hit in both
rolls.
Note that the number of points in the last frame is the total number of pins hit in all rolls.
Input will be from the keyboard containing the rolls for a single game, concatenated into a single
string. Each character will be one of the following: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /, or X, where
the digits represent the number of pins knocked down, the '/ ' indicates a spare, and the 'X'
represents a strike. Note that the frames are not delimited in any way-it’s your job to figure out if a
frame has one, two, or three rolls. Assume valid input. Output the frame/total game score using the
format shown below. Finally, ask the use if he/she wishes to run the program again.
Sample Runs:
Enter bowling scores for a game: 81XX3/451/XX3/4/8
Frames
1 2 3 4 5 6 7 8 9 10
--------------------------------------------------------------------
Total Score: 170
Run again(Y/N): y
8-1 X X 3 / 4-5 1 / X X 3 / 4/8
9 32 52 66 75 95 118 138 152 170
7
Enter bowling scores for a game: XXXXXXXXXX9/
Frames
1 2 3 4 5 6 7 8 9 10
--------------------------------------------------------------------
Total Score: 289
Run again(Y/N): Y
Enter bowling scores for a game: 101/22X33X1/3/X12
Frames
1 2 3 4 5 6 7 8 9 10
--------------------------------------------------------------------
1-0 1/ 2-2 X 3-3 X 1/ 3/ X 12
1 13 17 33 39 59 72 92 105 108
Total Score: 108
Run again(Y/N): n

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102`` ``````#include #include using namespace std; int main() { const int frame = 10; int roll = 0; int scores[frame]; int Total; string num; num = ('1', '2', '3', '4', '5', '6', '7', '8', '9', '/', 'X'); cout << "Enter bowling scores for a game: "; cin >> scores[frame]; if (roll == 1) { if (frame > 10) { if (scores[frame] == 10) { cout << "Strike" << endl; } else if (scores[frame] > 10) { cout << scores << endl; } else if (roll == 2) { if (scores[frame] == 10) { cout << "Spare" << endl; } else if (scores[frame] > 10) { cout << scores << endl; } else if (roll == 3) { if (frame == 10) { if (scores[frame] == 10) { cout << "Strike" << endl; } else if (scores[frame] > 10) { cout << scores << endl; } } } } } } cout << "Frames: " << endl; cout << '1' << '\t' << '2' << '\t' << '3' << '\t' << '4' << '\t' << '5'; cout << '\t' << '6' << '\t' << '7' << '\t' << '8' << '\t' << '9' << '\t' << "10" << endl; cout << "---------------------------------------------------------------------------" << endl; cout << "Total score: " << Total << endl; cin.ignore(); cin.get(); return 0; }``````
As you probably know, this code will not compile yet. Be sure to review the error messages to see what the compiler thinks might be wrong. It's good to get used to working through error messages, even if they are a bit daunting at first.

In this case, I received an "uninitialized local variable 'Total' used" error, which makes sense because we defined Total on line 13 but never assigned a value to it. Using a variable that has no value is bad news, hence the error. Generally speaking, you'll want to initialize a variable when you define it:

 `` `` ``int Total = 0;``

Beyond that, the flow of the program needs to be reworked.

 ``1234567891011`` ``````const int frame = 10; // okay, 10 frames per game int scores[frame]; int roll = 0; // should game start on frame 1? // 0 could make sense if used as for loop index int Total = 0; // always initialize string num; // unclear intentions, discussion below num = ('1', '2', '3', '4', '5', '6', '7', '8', '9', '/', 'X'); cout << "Enter bowling scores for a game: "; cin >> scores[frame]; // probably not intended ``````

For string num, what information is this supposed to hold? As is, I think it assigns and then overwrites each character in order until it reaches 'X'. Probably not intended. If you want it to hold all of those characters, you can initialize via string assignment.

 `` `` ``string num = "123456789/X";``

For cin >> scores[frame], remember that the variable frame == 10. Therefore your cin operation gets a value from the user and tries to store it in scores[10]. I'd imagine this leads us to going out of bounds since an array of size 10 goes from 0 to 9.

There are a number of other issues as well that I'll mention briefly.

1) Give your variables short but descriptive names. This will help you remember what they do. For example, "frame" can be renamed to "max_frames" since it represents the total number of frames in a game rather than the current frame.

2) Make sure that your if() blocks finish execution. Currently else if(roll == 2) (line 41) and the stuff below it will never execute because they're stuck inside the if(roll == 1) (line 21) block.

3) Loops are a great way to perform a set of instructions repeatedly. I think you'll find the program benefits greatly from a for, while or do-while loop. http://www.cplusplus.com/doc/tutorial/control/

Good luck!
Last edited on
Okie dokie so I've been working a bit on the code, and I think maybe I might be getting a bit further on the project. Not sure if it runs for some reason all of the == operands wont work! Please help!

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130`` `````` #include #include #include // Also know that I can only use one string just dont know which. using namespace std; int main() { const int size = 21; //Hold all frame scores char answer; // Hold the Y || N answer int frame = 1; // Beginning frame int roll; // Starting roll int scores[size]; // To get all of the scores. int Total; // Add all the scores together. string pins; pins = ('1', '2', '3', '4', '5', '6', '7', '8', '9', '/', 'X'); do { cout << "Enter bowling scores for a game: "; cin >> scores[size]; for (int count = 9; frame < count; frame++) { for (int x = 1; roll <= x; roll++) { if (pins == 10) { cout << 'X' << "Strike" << endl; Total += pins; } else if (pins > 10) { cout << pins << endl; Total += pins; } } for (int z = 2; roll == z; roll++) { if (pins == 10) { cout << "Stike" << endl; Total += pins; } else if (pins > 10) { cout << pins << endl; Total += pins; } else if (pins) // To get a spare... { } } } for (int c = 0; frame == 10;) { for (int a = 3; roll == a; roll++) { if (pins == 10) { cout << "Stike" << endl; Total += pins; } else if (pins > 10) { cout << pins << endl; Total += pins; } } } cout << "Frames: " << endl; cout << '1' << '\t' << '2' << '\t' << '3' << '\t' << '4' << '\t' << '5'; cout << '\t' << '6' << '\t' << '7' << '\t' << '8' << '\t' << '9' << '\t' << "10" << endl; cout << "---------------------------------------------------------------------------" << endl; cout << pins << endl; cout << "Total is: " << Total << endl; cout << "Do you want to run again?(Y/N): "; cin >> answer; } while (answer == 'Y' || answer == 'y'); cin.get(); return 0; }``````
Looks like progress.

1) "all of the == operands wont work!"
The == comparisons don't work because they're trying to compare a string (pins) to an integer (10). Those are different types and should not be compared.

2) Lines 18 and 19

 ``12`` ``````string pins; pins = ('1', '2', '3', '4', '5', '6', '7', '8', '9', '/', 'X');``````

Print out the value of pins immediately after. You'll see that it's value is "X", which is probably not what you want.

3) `#include <cstring> // ...dont know which. `
Stick with <string> for this assignment. <cstring> is for when you work with strings built using C syntax.

4) Break it down into small steps.
I find that focusing on one small task at a time makes coding easier. Don't worry much about the bigger pieces to begin with.

For example, the assignment says that the user will give your program a string. Here's one sample input: `81XX3/451/XX3/4/8`

So Step 1 = Get string from user.

 ``12`` ``````cout << "Enter bowling scores for a game: "; cin >> scores[size];``````

This causes a crash. It tries to store an entire series of characters into a single cell in an array of ints. That cell also happens to be out of bound.

 ``12`` ``````string user_input; cin >> user_input;``````

Strings work like arrays in that you can access their characters individually via brackets Ex: `user_input[0]`

Once you have the user's input, think about what you want to do with that very first score. Write code to handle just that score. When it makes sense to you, expand to handle the second score. Don't worry about anything else until you're comfortable tackling first two scores.
Last edited on
Okay so my professor did an update, but I have no idea if this helps or confuses me even more :/ so here is the code. Should I stick with my old code or this new code? It is due on the 8th and I need some serious help lol

 ``1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586`` ``````#include #include #include using namespace std; int main() { int PinsLeft = 0; int throwTot = 0; int PinsHit; int Math; const int size = 21; //Hold all frame scores char answer; // Hold the Y || N answer int frame = 1; // Beginning frame int roll = 1; // Starting roll string User_Input; // To get all of the scores. int Total = 0; // Add all the scores together. string pins = ("1", "2", "3", "4", "5", "6", "7", "8", "9", "/", "X"); do { cout << "Enter bowling scores for a game: "; cin >> User_Input; cout << "Frames: " << endl; cout << '1' << '\t' << '2' << '\t' << '3' << '\t' << '4' << '\t' << '5'; cout << '\t' << '6' << '\t' << '7' << '\t' << '8' << '\t' << '9' << '\t' << "10" << endl; cout << "---------------------------------------------------------------------------" << endl; // My professor gave me the part beneath it but I have no idea what to do with it. PinsHit = (int)((PinsLeft + 1) * Math.random); throwTot += PinsHit; //if a strike is bowled if (roll == 1 && PinsHit == 10) { Total += 20; throwTot = 0; } else if (roll == 2) { //if a spare is bowled if (throwTot == 10) { Total += 15; } else { Total += throwTot; throwTot = 0; } return(PinsHit); } cout << PinsHit << endl; cout << "Do you want to run again?(Y/N): "; cin >> answer; } while (answer == 'Y' || answer == 'y'); cin.get(); return 0; } ``````
What your professor gave you is not making sense.
Line 41: Math is a simple int. It does not have a member variable called random.

The original problem description does not imply the use of random numbers.
It simply converts a string into a score for the game.
Okay I need some serious help! I do not understand anything my professor has posted and that was not alot to go off of any ways! I need as much help as possible this is due on the 8th and I've been working almost everyday on it!! Please help me make sense of this code, not sure if I'm still even going in the right direction! Thanks in advance

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146`` ``````#include #include #include using namespace std; int main() { const int PinsHit = 0; char answer; // Hold the Y || N answer int frame = 1; // Beginning frame int roll = 1; // Starting roll string User_Input; // To get all of the scores. int Total = 0; // Add all the scores together. string pins = { {'1'},{'2'}, {'3'},{'4'}, {'5'},{'6'},{'7'},{'8'},{'9'},{'/'},{'X'} }; do { cout << "Enter bowling scores for a game: "; cin >> User_Input; cout << "Frames: " << endl; cout << '1' << '\t' << '2' << '\t' << '3' << '\t' << '4' << '\t' << '5'; cout << '\t' << '6' << '\t' << '7' << '\t' << '8' << '\t' << '9' << '\t' << "10" << endl; cout << "---------------------------------------------------------------------------" << endl; for (int count = 9; frame < count; frame++) { if (User_Input >= "1" && User_Input <= "9") { Total += PinsHit; //if a strike is bowled if (roll == 1 && User_Input == "X") { cout << pins[10] << endl; Total += 20; } else if(User_Input[0-9] == pins[0 -10]) { cout << pins << endl; Total = 0; } if (roll == 2) { //if a spare is bowled if (Total == 10) { cout << pins[10] << endl; Total += 15; } else { } return PinsHit; } } else if (User_Input[0-10] == pins[10]) { cout << "Strike" << endl; } else if (User_Input[0]-User_Input[10] == pins[9]) { cout << "Spare" << endl; } } for (int count = 10; frame == count;) { if (pins == User_Input) { Total += PinsHit; //if a strike is bowled if (roll == 1 && PinsHit == 10) { cout << pins[11] << endl; Total += 20; Total = 0; } if (roll == 2) { //if a spare is bowled if (Total == 10) { cout << pins[10] << endl; Total += 15; } else { } return PinsHit; } } } cout << "Do you want to run again?(Y/N): "; cin >> answer; } while (answer == 'Y' || answer == 'y'); cin.get(); return 0; } ``````
 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149`` ``````#include #include #include using namespace std; int main() { const int PinsHit = 50; char answer; // Hold the Y || N answer int frame = 1; // Beginning frame int roll = 1; // Starting roll string User_Input; // To get all of the scores. int Total = 0; // Add all the scores together. string pins = { {'1'},{'2'}, {'3'},{'4'}, {'5'},{'6'},{'7'},{'8'},{'9'},{'/'},{'X'} }; do { cout << "Enter bowling scores for a game: "; cin >> User_Input; cout << "Frames: " << endl; cout << '1' << '\t' << '2' << '\t' << '3' << '\t' << '4' << '\t' << '5'; cout << '\t' << '6' << '\t' << '7' << '\t' << '8' << '\t' << '9' << '\t' << "10" << endl; cout << "---------------------------------------------------------------------------" << endl; for (int count = 9; frame < count; frame++) { if (User_Input >= "1" && User_Input <= "9") { Total += PinsHit; //if a strike is bowled if (roll == 1 && User_Input == "X") { cout << pins[10] << endl; Total += 20; roll++; } else if (pins <= "9") { cout << User_Input[0] << endl; Total = 0; roll++; } if (roll == 2) { //if a spare is bowled if (Total == 10) { cout << pins[10] << endl; Total += 15; roll++; } else { roll++; } } } else if (pins[10] == User_Input[0]) { cout << pins[10] << endl; roll++; } else if (pins[9] == User_Input[0]) { cout << pins[9] << endl; roll++; } } for (int count = 10; frame == count;) { if (User_Input[PinsHit]) { Total += PinsHit; //if a strike is bowled if (roll == 1 && PinsHit == 10) { cout << pins[11] << endl; Total += 20; Total = 0; roll++; } if (roll == 2) { //if a spare is bowled if (Total == 10) { cout << pins[10] << endl; Total += 15; roll++; } else { roll++; } } } } cout << "Do you want to run again?(Y/N): "; cin >> answer; } while (answer == 'Y' || answer == 'y'); cin.get(); return 0; } ``````

????
 ????

Line 13: Why is PinsHit initialized to 50?

Line 41: User_Input is a string containing multiple characters. You're doing a compare of the entire input string to "1" or "9". The comparison will always be false. You want to compare a single character to a character literal (not a quoted string).

Line 46: Ditto regarding User_Input.

Lines 47-52: Also, assuming you correct line 41 and 46, these lines can never be executed. They are within the range of the if at line 41. User_Input[x] can't be an "X" if you've already made sure it's between '1' and '9'.

Line 64: Isn't Total the score for the game? That's not going to work for detecting a spare.

Line 67,116: Why are you adding 15?

Line 97: This is going to cause an out of bounds reference since PinsHit was initialized to 50.
User_Input is not that long.

My question was in the post before, I am not sure if I'm going in the right direction this code is due on the 8th.

With PinsHit I was testing things out because it kept popping up telling me when i was getting the UserInput [PinsHit] that it would cause a break for some reason and never figured out why.

Again I was trying to incorporate what my professor was giving us above to figure out this code. I had User Input set to 10 originally.
 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273`` ``````#include #include #include using namespace std; int main() { const int PinsHit = 11; char answer; // Hold the Y || N answer int frame = 1; // Beginning frame int roll = 1; // Starting roll char User_Input; // To get all of the scores. int Total = 0; // Add all the scores together. string pins[] = { { "1" },{ "2" },{ "3" },{ "4" },{ "5" },{ "6" },{ "7" },{ "8" },{ "9" },{ "/" },{ " X" } }; do { cout << "Enter bowling scores for a game: "; cin >> User_Input; cout << "Frames: " << endl; cout << '1' << '\t' << '2' << '\t' << '3' << '\t' << '4' << '\t' << '5'; cout << '\t' << '6' << '\t' << '7' << '\t' << '8' << '\t' << '9' << '\t' << "10" << endl; cout << "---------------------------------------------------------------------------" << endl; for (int count = 9; frame < count; frame++) { //if a strike is bowled if (roll == 1 && User_Input == 'X') { cout << pins[10] << endl; Total += 20; roll++; } else if (User_Input == '/') { cout << pins[9] << endl; Total = 10; roll++; } else if (User_Input == '9') { cout << pins[8] << endl; Total += 9; roll++; } else if (User_Input == '8') { cout << pins[7] << endl; Total += 8; roll++; } else if (User_Input == '7') { cout << pins[6] << endl; Total += 7; roll++; } else if (User_Input == '6') { cout << pins[5] << endl; Total += 6; roll++; } else if (User_Input == '5') { cout << pins[4] << endl; Total += 5; roll++; } else if (User_Input == '4') { cout << pins[3] << endl; Total += 4; roll++; } else if (User_Input == '3') { cout << pins[2] << endl; Total += 3; roll++; } else if (User_Input == '2') { cout << pins[1] << endl; Total += 2; roll++; } else if (User_Input == '1') { cout << pins[0] << endl; Total += 1; roll++; } if (roll == 2) { if (User_Input == 'X') { cout << pins[9] << endl; Total += 15; roll++; } else if (User_Input == '/') { cout << pins[9] << endl; Total += 15; roll++; } else if (User_Input == '9') { cout << pins[8] << endl; Total += 9; roll++; } else if (User_Input == '8') { cout << pins[7] << endl; Total += 8; roll++; } else if (User_Input == '7') { cout << pins[6] << endl; Total += 7; roll++; } else if (User_Input == '6') { cout << pins[5] << endl; Total += 6; roll++; } else if (User_Input == '5') { cout << pins[4] << endl; Total += 5; roll++; } else if (User_Input == '4') { cout << pins[3] << endl; Total += 4; roll++; } else if (User_Input == '3') { cout << pins[2] << endl; Total += 3; roll++; } else if (User_Input == '2') { cout << pins[1] << endl; Total += 2; roll++; } else if (User_Input == '1') { cout << pins[0] << endl; Total += 1; roll++; } } //if a spare is bowled if (Total == 10) { cout << pins[9] << endl; Total += 15; roll++; } } for (int count = 10; frame == count;) { if (User_Input) { Total += PinsHit; //if a strike is bowled if (roll == 1 && PinsHit == 10) { cout << pins << endl; Total += 20; Total = 0; roll++; } if (roll == 2) { //if a spare is bowled if (Total == 10) { cout << pins << endl; Total += 15; roll++; } else { roll++; } } } } cout << "Do you want to run again?(Y/N): "; cin >> answer; } while (answer == 'Y' || answer == 'y'); cin.get(); return 0; }``````

Okay so now the only issue I feel like I'm having is coming the individual chars of a string to the chars themselves. Please help this is due in 3 days!!
 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265`` ``````#include #include #include using namespace std; int main() { int iteratorCount = 0; string::iterator it; const int PinsHit = 11; char answer; // Hold the Y || N answer int frame = 1; // Beginning frame int roll = 1; // Starting roll string User_Input; // To get all of the scores. int Total = 0; // Add all the scores together. char pins[] = { { '1' },{ '2' },{ '3' },{ '4' },{ '5' },{ '6' },{ '7' },{ '8' },{ '9' },{ '/' },{ 'X' } }; do { cout << "Enter bowling scores for a game: "; cin >> User_Input; cout << "Frames: " << endl; cout << '1' << '\t' << '2' << '\t' << '3' << '\t' << '4' << '\t' << '5'; cout << '\t' << '6' << '\t' << '7' << '\t' << '8' << '\t' << '9' << '\t' << "10" << endl; cout << "---------------------------------------------------------------------------" << endl; for (it = User_Input.begin(); it != User_Input.end(); it++) { iteratorCount++; if (frame <= 9) { //if a strike is bowled if (roll == 1 && (*it == 'X')) { cout << pins[10] << endl; Total += 20; roll++; it++; } else if (*it == '/') { cout << pins[9] << endl; Total = 10; roll++; it++; } else if (*it == '9') { cout << pins[8] << endl; Total += 9; roll++; it++; } else if (*it == '8') { cout << pins[7] << endl; Total += 8; roll++; it++; } else if (*it == '7') { cout << pins[6] << endl; Total += 7; roll++; it++; } else if (*it == '6') { cout << pins[5] << endl; Total += 6; roll++; it++; } else if (*it == '5') { cout << pins[4] << endl; Total += 5; roll++; it++; } else if (*it == '4') { cout << pins[3] << endl; Total += 4; roll++; it++; } else if (*it == '3') { cout << pins[2] << endl; Total += 3; roll++; it++; } else if (*it == '2') { cout << pins[1] << endl; Total += 2; roll++; it++; } else if (*it == '1') { cout << pins[0] << endl; Total += 1; roll++; it++; } if (roll == 2) { if (*it == 'X') { cout << pins[9] << endl; Total += 15; roll++; it++; } else if (*it == '/') { cout << pins[9] << endl; Total += 15; roll++; } else if (*it == '9') { cout << pins[8] << endl; Total += 9; roll++; it++; } else if (*it == '8') { cout << pins[7] << endl; Total += 8; roll++; it++; } else if (*it == '7') { cout << pins[6] << endl; Total += 7; roll++; it++; } else if (*it == '6') { cout << pins[5] << endl; Total += 6; roll++; it++; } else if (*it == '5') { cout << pins[4] << endl; Total += 5; roll++; it++; } else if (*it == '4') { cout << pins[3] << endl; Total += 4; roll++; it++; } else if (*it == '3') { cout << pins[2] << endl; Total += 3; roll++; it++; } else if (*it == '2') { cout << pins[1] << endl; Total += 2; roll++; it++; } else if (*it == '1') { cout << pins[0] << endl; Total += 1; roll++; it++; } //if a spare is bowled if (Total == 10) { cout << pins[9] << endl; Total += 15; roll++; } } } } for (int count = 10; frame == count;) { } cout << "Do you want to run again?(Y/N): "; cin >> answer; } while (answer == 'Y' || answer == 'y'); cin.get(); return 0; }``````

Here is what I have...The only thing left to do is make the frames go up by one, and than make it read 'X' and '/'!
Topic archived. No new replies allowed.