Question: C + + PROGRAM On your menu you will now have a Quit option. Instead of having to re - run the program to be

C++ PROGRAM
On your menu you will now have a "Quit" option. Instead of having to re-run the program to be able to enter information for each of the three events, the user will now be able to continuously enter information based on the event that he/she selects. The points that are assigned based on the rankings of each event should now be
accumulated to represent all points earned. instead of providing a ranking for each of the events, you will now provide an overall competition ranking based on the accumulated points. If the user chooses to not enter information for one, ore more, of the events, then there should not be any points assigned to that event. Your output should display each of the competitors listed from 1st place to last place, their"winning" status (seconds, weights, counts used in the competitions), and the number of points that he/she earned overall. Lastly, you should now have appropriate input validation to where if the user enters an incorrect value for an input that he/she re-enters the information. The program should not longer end if invalid input is entered.
#include
#include
#include
using namespace std;
int main()
{
string competitor1, competitor2, competitor3;
cout "Enter the name of the first competitor: ";
getline (cin, competitor1);
cout "Enter the name of the second competitor: ";
getline(cin, competitor2);
cout "Enter the name of the third competitor: ";
getline(cin, competitor3);
int choice;
cout "Select the event:
";
cout "1. Stone Over
";
cout "2. Farmers Frame Medley
";
cout "3. Axle Deadlift
";
cin >> choice;
if (choice 1|| choice >3)
{
cout "Invalid choice. Program will terminate.
";
return 1;
}
double c1_attempt1, c1_attempt2, c2_attempt1, c2_attempt2, c3_attempt1, c3_attempt2;
double c1_best, c2_best, c3_best;
std::string firstPlace, secondPlace, thirdPlace;
int firstPoints =3, secondPoints =2, thirdPoints =1;
switch (choice)
{
case 1:
{
cout "You have selected Stone Over.
";
// Input attempts for each competitor
cout "Enter two attempts for " competitor1": ";
cin >> c1_attempt1>> c1_attempt2;
cout "Enter two attempts for " competitor2": ";
cin >> c2_attempt1>> c2_attempt2;
cout "Enter two attempts for " competitor3": ";
cin >> c3_attempt1>> c3_attempt2;
// Determine the best attempt
if (c1_attempt1> c1_attempt2){
c1_best = c1_attempt1;
} else {
c1_best = c1_attempt2;
}
if (c2_attempt1> c2_attempt2){
c2_best = c2_attempt1;
} else {
c2_best = c2_attempt2;
}
if (c3_attempt1> c3_attempt2){
c3_best = c3_attempt1;
} else {
c3_best = c3_attempt2;
}
// Rank the competitors
if (c1_best > c2_best and c1_best > c3_best){
firstPlace = competitor1;
if (c2_best > c3_best)
{
secondPlace = competitor2;
thirdPlace = competitor3;
} else
{
secondPlace = competitor3;
thirdPlace = competitor2;
}
} else if (c2_best > c1_best and c2_best > c3_best){
firstPlace = competitor2;
if (c1_best > c3_best)
{
secondPlace = competitor1;
thirdPlace = competitor3;
} else {
secondPlace = competitor3;
thirdPlace = competitor1;
}
} else {
firstPlace = competitor3;
if (c1_best > c2_best){
secondPlace = competitor1;
thirdPlace = competitor2;
} else {
secondPlace = competitor2;
thirdPlace = competitor1;
}
}
// Display the results
cout "Event: Stone Over
";
cout "1st Place: " firstPlace "(" firstPoints " points)
";
cout "2nd Place: " secondPlace "(" secondPoints " points)
";
cout "3rd Place: " thirdPlace "(" thirdPoints " points)
";
break;
}
case 2:
{
// Farmers Frame Medley
cout "You have selected Farmers Frame Medley.
";
// Input time in seconds
cout "Enter two attempts for " competitor1"(in seconds): ";
cin >>c1_best = c1_attempt2;
}
if (c2_attempt1> c2_attempt2){
c2_best = c2_attempt1;
}) else {
c
 C++ PROGRAM On your menu you will now have a "Quit"

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!