How to write a bowling score with infinitely loop

Hello, I am a beginners in c. I want to write a bowling score with infinitely loop. Sorry about my English!

Here is requested:
The game consists of n ( instead of 10) frames. The score calculation for the first n-1 frames (resp. last frame) is the same as that for the first 9 frames(resp. last frame) of the original standard bowling game.

In particular, in the last frame if the player gets a strike, he gets two bonus rolls. If he gets only a spare, he gets only one bonus roll. If he doesn't get a strike or spare, the whole game ends.

In here, I confuse how to make it stop in the last frame, and how to make it infinitely?


Thank you!

You need a loop that will continue until the condition is equal to ending the game, i.e. doesn't get a strike or spare. Something like:

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
enum Result
{
	none = 0,
	strike,
	spare
};

class Game
{
public:
	Game()
	{}

	Result Play()
	{
		Result r(none);

		// to do
		
		return r;
	}
};

int main()
{
	Result r(none);
	Game g;

	do
	{
		r = g.Play();
	} while (r == strike || r == spare);


	return 0;
}
Topic archived. No new replies allowed.