Question: Write a C++ program which creates a Scores structure with a string variable firstName and integer variable score. You will prompt the user to enter

Write a C++ program which creates a Scores structure with a string variable firstName and integer variable score. You will prompt the user to enter five players and their scores from a game they have been playing. The user will enter the first name and then the score for each player.

Enter info for player 1 _______________________________ Please enter the players first name:

The user will enter the first name and then the score for each player.

Enter info for player 1 _______________________________ Please enter the players first name: Bob Please enter the players score: 33 Enter info for player 2 _______________________________ Please enter the players first name: Mary Please enter the players score: 45 Enter info for player 3 _______________________________ Please enter the players first name: Bob Please enter the players score: 76

Then show a menu with the following options:

Press 1 to show the highest score for one player Press 2 to show all scores for a particular players Press 3 to show all scores for all players Press 4 to show a list of players Press 0 to exit the program.

I want the menu and all the select-case code inside a while loop allowing the player to return to the menu and select other options. You don't need to prompt them to return to the menu because there is an exit menu item. DON"T program the loop until you finish the entire program. It's not necessary until you know all the other parts work - which you should work on one at a time and test-test-test.

Each menu item will product a different output. For example:

Enter info for player 1 _______________________________ Please enter the players first name: Bob Please enter the players score: 33 Enter info for player 2 _______________________________ Please enter the players first name: Mary Please enter the players score: 44 Enter info for player 3 _______________________________ Please enter the players first name: Bob Please enter the players score: 67 Enter info for player 4 _______________________________ Please enter the players first name: Bob Please enter the players score: 22 Enter info for player 5 _______________________________ Please enter the players first name: Mary Please enter the players score: 98

Press 1 to show the highest score for one player Press 2 to show all scores for a particular user Press 3 to show all scores for all users Press 4 to show a list of users Press 0 to exit the program.

1 Please enter the player's name Bob Bob's Score: 67

Press 1 to show the highest score for one player Press 2 to show all scores for a particular user Press 3 to show all scores for all users Press 4 to show a list of users Press 0 to exit the program.

2 Please enter the player's name

Bob Bob Score: 33 Bob Score: 67 Bob Score: 22

Press 1 to show the highest score for one player Press 2 to show all scores for a particular user Press 3 to show all scores for all users Press 4 to show a list of users Press 0 to exit the program.

3 _______________________________ Player 0: Bob Score: 33

_______________________________ Player 1: Mary Score: 44

_______________________________ Player 2: Bob Score: 67

_______________________________ Player 3: Bob Score: 22

_______________________________ Player 4: Mary Score: 98

Press 1 to show the highest score for one player Press 2 to show all scores for a particular user Press 3 to show all scores for all users Press 4 to show a list of users Press 0 to exit the program.

4 _______________________________ Player 0: Bob

_______________________________ Player 1: Mary

_______________________________ Player 2: Bob

_______________________________ Player 3: Bob

_______________________________ Player 4: Mary

Press 1 to show the highest score for one player Press 2 to show all scores for a particular user Press 3 to show all scores for all users Press 4 to show a list of users Press 0 to exit the program.

0

Good-Bye!

code i have:

#include #include

using namespace std;

struct GPA { string firstName; string lastName; double gpa; };

int main() { GPA gpa[3];

for (int i = 1; i < 4; i++) { cout << "Enter info for person " << i << " " << "_______________________________" << endl; cout << "Please enter the student's first name: "; cin >> gpa[i].firstName; cout << "Please enter the student's last name: "; cin >> gpa[i].lastName; cout << "Please enter the student's gpa: "; cin >> gpa[i].gpa; }

for (int i = 1; i < 4; i++) { cout << "_______________________________" << endl; cout << gpa[i].firstName << gpa[i].lastName << " GPA: " << gpa[i].gpa << endl; } return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!