create a new file in c++. In this lab, you will add some more functionality to the program. Use loops to keep running the program until the user chooses the exit condition (X or x). When dividing, use a loop to validate user input, making sure the denominator (second number) is not zero. If the user enters a 0 for the second number, display an error message and ask them again. A)   Add two numbersB)   Subtract two numbersC)   Multiply two numbersD)   Divide two numbersX)   Exit program The program should: display a "hello" message before presenting the menu display the menu prompt user for selection accept either uppercase or lowercase for selection display error message if invalid selection is made (example: E) display the selection back to the user prompt for two numbers perform the operation and display the results use loop for input validation of second number during division display error message for division when second number is 0 after displaying result, use loop to present menu again and ask for another selection do not display "hello" message again display a "goodbye" message before exiting the program

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section5.4: For Loops
Problem 11E
icon
Related questions
Question

create a new file in c++.

In this lab, you will add some more functionality to the program. Use loops to keep running the program until the user chooses the exit condition (X or x). When dividing, use a loop to validate user input, making sure the denominator (second number) is not zero. If the user enters a 0 for the second number, display an error message and ask them again.

A)   Add two numbers
B)   Subtract two numbers
C)   Multiply two numbers
D)   Divide two numbers
X)   Exit program

The program should:

  • display a "hello" message before presenting the menu
  • display the menu
  • prompt user for selection
    • accept either uppercase or lowercase for selection
    • display error message if invalid selection is made (example: E)
  • display the selection back to the user
  • prompt for two numbers
  • perform the operation and display the results
    • use loop for input validation of second number during division
    • display error message for division when second number is 0
  • after displaying result, use loop to present menu again and ask for another selection
    • do not display "hello" message again
  • display a "goodbye" message before exiting the program
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning