Question

In: Computer Science

Write a program in C++ coding that utilizes a DO-WHILE loop to redisplay a menu to...

Write a program in C++ coding that utilizes a DO-WHILE loop to redisplay a menu to the user.

Ask the user to input their favorite SuperHero and display a positive or funny comment about the chosen SuperHero. If RBG is chosen, display "You can't spell TRUTH without RUTH."

Utilize a Do-While Loop to redisplay the menu to the user after item 1, 2 or 3 is executed. If item 4 is chosen, end the program.

If the user chooses 4, end the program.

1. Superman (or a SuperHero of your Choice)

2. Batman (or a Superhero of your choice)

3. The Notorious RBG (non-negotiable, RBG must be a menu choice)

4. Quit

Solutions

Expert Solution

Code :

#include <iostream>

using namespace std;

int main()
{
int selection;
do
{
cout<<"\n Menu (Enter 1,2 or 3 to select and 4 to quit)"<<"\n";
cout<<"\n 1: Super Man";
cout<<"\n 2: Bat Man";
cout<<"\n 3: The Notorious RBG";
cout<<"\n 4: Quit";
cout<<"\n\n Enter selection: ";
cin>>selection;
  
if(selection == 1){
cout<<" Superman is Super. \n";
}
if(selection == 2){
cout<<" Batman is not Bat. \n";
}
if(selection == 3){
cout<<" You can't spell TRUTH without RUTH. \n";
}
}while(selection != 4);
  
return 0;
}

Code Screenshot :

Output screenshot :


Related Solutions

Do the following lab by while or Do-while loop. question: Write a c++ program that asks...
Do the following lab by while or Do-while loop. question: Write a c++ program that asks students to enter 3 valid grades and then calculate the average and print it. if the user enters the invalid grade you should print the error message and get the new grade. Hint1: each time your program ask the following question: "Do you want to calculate another average?" and if the answer to this question is "Y" or "y" then you should continue. Hint2:...
Multiples of 2 and 3: write a c++ program Using a while loop, write a program...
Multiples of 2 and 3: write a c++ program Using a while loop, write a program that reads 10 integer numbers. The program shall count how many of them are multiples of 2, how many are multiples of 3, and how many are NOT multiples of either 2 or 3. The output should be similar to the one shown below.
You are to write a program in C to do the following in a loop for...
You are to write a program in C to do the following in a loop for the KL46Z . Prompt the user for a positive integer greater than 1 and sanity-check the input. If the number is a prime number, it is to be printed on a new line in red text. If the number is evenly divisible by 7, it is to be printed on a new line in green text. If the current number is evenly divisible by...
1 for each of the problems listed below write the c++ program while using WHILE loop...
1 for each of the problems listed below write the c++ program while using WHILE loop structures A program will display each term in the following sequence 1 -10 100 -1000 10000 -100000 1000000 A program will calculate and display the corresponding celsius temperatures for the given Farenheit ones from 0f to 212 f (hint c=(f-32/1.8)
Write a C program that meets the following requirements. Uses a while loop to display the...
Write a C program that meets the following requirements. Uses a while loop to display the first 10 natural numbers (on one row, with a tab separating each number) Uses a while loop to find the sum of the second set of 10 natural numbers. Reads a user entry and displays all the natural numbers up to the user entry (on a column list with a new line separating each number). Finds and displays the sum of all natural numbers...
Modify the previous program to use the Do-While Loop instead of the While Loop. This version...
Modify the previous program to use the Do-While Loop instead of the While Loop. This version of the program will ask the user if they wish to enter another name and accept a Y or N answer. Remove the "exit" requirement from before. Output: Enter the full name of a person that can serve as a reference: [user types: Bob Smith] Bob Smith is reference #1 Would you like to enter another name (Y or N)? [user types: y] Enter...
Write a Java program that uses a while loop to do the following: Repeatedly asks the...
Write a Java program that uses a while loop to do the following: Repeatedly asks the user to enter a number or -1 to exit the program. Keeps track of the smallest and largest numbers entered so far: You will need a variable for the smallest number and another variable for the largest number. Read the first number the user enters, and if it is not -1 set the smallest and largest variables to that number. Use a loop to...
write a program bus management system? using: if else, for loop, do while loop, function, arrays,...
write a program bus management system? using: if else, for loop, do while loop, function, arrays, string, structure
write an operational semantic for a while loop in c++
write an operational semantic for a while loop in c++
C++ while loop Exercise Write a program that continues to ask the user to enter any...
C++ while loop Exercise Write a program that continues to ask the user to enter any set of numbers, until the user enters the number -1. Then display the total sum of numbers entered and their average. (note that you need to define a counter that counts how many numbers so the average = (sum/n) where n is your counter total. #include <iostream> using namespace std; int main() { int number, n=0, sum=0; cout << "Enter a number to start...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT