Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Could you please do it in C++ vim terminal and use only one return at the end of the program instead of two!!! Array should

Could you please do it in C++ vim terminal and use only one return at the end of the program instead of two!!!

Array should be [21]!!

And make it as simple as possible!

Assignment:You will be writing a program to score bowling for several players. Your job will be to ask for players and their scores, then add up their score. When all players have been entered, the user will type "done". Then, your program will tally up the worst and best player and output who won and who lost the game.

Restrictions / Hints

1. You must use a vector to store all of the player names. All player names will be a single name.

2. You must use another vector to store the total score for each player. You must calculate the total score for each player after all rolls have been entered.

3. You must use an array to store each roll's value.

4. The number of rolls is variable depending on whether the player threw a strike (knocked down 10 pins in one roll), spare, or neither. Please see "Scoring Bowling" below.

5. You must use a for loop to input the roll values into the array.

6. If the user types "done" before entering any names, output "No players were entered."

7. In the event of a tie, the first player (lowest vector index) to obtain the best or worst score is printed.

8. You can assume that the user will input valid scores. You do not need to perform error checking for invalid input.

image text in transcribed

image text in transcribed

Enter player's name (done for no more players): John Enter score for frame 1, roLL 1: 10 Enter score for frame 2, roll 1: 10 Enter score for frame 3, roll 1: 10 Enter score for frame 4, roll 1: 10 Enter score for frame 5, roll 1: 10 Enter score for frame 6, roll 1: 10 Enter score for frame 7, roll 1: 10 Enter score for frame 8, roll 1: 10 Enter score for frame 9, roll 1: 10 Enter score for frame 10, roll 1: 10 Enter score for frame 10, roll 2: 10 Enter score for frame 10, roll 3: 10 Enter player's name (done for no more players): Cheryl Enter score for frame 1, roll 1: 8 Enter score for frame 1, roll 2: 1 Enter score for frame 2, roll 1: 0 Enter score for frame 2, roll 2: 9 Enter score for frame 3, roll 1: 2 Enter score for frame 3, roll 2: 8 Enter score for frame 4, roll 1: 10 Enter score for frame 5, roll 1: 6 Enter score for frame 5, roll 2: 3 Enter score for frame 6, roll 1: 7 Enter score for frame 6, roll 2: 0 Enter score for frame 7, roll 1: 5 Enter score for frame 7, roll 2: 2 Enter score for frame 8, roll 1: 10 Enter score for frame 9, roll 1: 0 Enter score for frame 9, roll 2: 6 Enter score for frame 10, roll 1: 2 Enter score for frame 10, roll 2: 8 Enter score for frame 10, roll 3: 10 Enter player's name (done for no more players): done John scored 300 Cheryl scored 122 Cheryl did the worst by scoring 122. John won the game by scoring 300 Enter player's name (done for no more players): done No players were entered

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions