Reference no: EM132197906
Question :
Write a complete C++ program that inputs three numbers representing the number of pins knocked down by a bowler in three throws.
Your program should output the computed bowling score, and check for possible input errors.
For example, a throw may be in the range of 0 through 10 points, and the total of the first 2 throws must be less than or equal to 10. except when the 1st throw is a strike.
The rules of bowling are that if the first throw is a strike (all 10 pins knocked down), then the score is equal to those 10 points plus the number knocked down in the next 2 rows.
Thus the maximum score (3 strikes) is 30. If the 1st throw knocks down fewer than 10 pins, but the second throw knocks down the remainder of the 10 pins (a spare), then the score is those 10 points plus the number of pins knocked down on the third throw.
If the first 2 throws fail to knock down all of the pins (a blow), then the score is just the total number of pins knocked down in the first 2 throws.