Question: Goal: To apply/demonstrate knowledge of random numbers, loops, file structures and functions- topics from chapters 3-6 Create a program for a bowling competition that does
Goal: To apply/demonstrate knowledge of random numbers, loops, file structures and functions- topics from chapters 3-6 Create a program for a bowling competition that does the following: There are four bowling scores for each person (bowler) -each score is between 80 and 180. These scores should be generated using the random number generator (see pages 128-131). The program will ask (using cout, cin) for the number of bowlers. This should be a number between three and six inclusive. A for loop should be used in the main program to process this number of bowlers. A function CalculateScore should display the four scores for each bowler. It should calculate and display the average of the three scores that remain after the lowest scores is dropped for each person. This function should be called by main for each person and passed the four scores. Additional functions can be used if needed. After all bowlers have been given their average, the winner (person with highest score) should be announced. Sample output might look like: There are 3 bowlers. Scores for Bowler1 are: 96, 86, 97, 105 The average of the three scores used is: 99.3 Scores for Bowler2 are: 85, 99, 88, 100 The average of the three scores used is: 95.6 Scores for Bowler3 are: 95, 84, 107, 118 The average of the three scores used is: 106.6 The winner is Bowler3 with a high score of: 106.6 The output should be sent to two places. It should go to the screen (using cout) and it should be sent to an output file. The name of the output file should be "your last name.txt". The calculated scores should contain and show one decimal place, as demonstrated above
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
