Lab 6: Conditionals


Write a program that takes as input three integers representing the number of pins knocked down by a bowler in three throws. The rules of bowling are such 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 on the next two throws. The maximum score (three strikes) is 30. If the first 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 10 points plus the number of pins knocked down on the third throw. If the first two 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 two throws. Your program should output the computed score, and also should check for erroneous input. For example, a throw may be in the range of 0 through 10 pins, and the total of the first two throws must be less than or equal to 10, except when the first throw is a strike. Make your error messages informative.
Save your file as lab6.cpp.