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?
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;
}