Command Line Calculator   The program will ask the user to select a function from 1-5 (1-Add, 2-Subtract, 3-Multiply, 4- Divide, 5-Exit the program). Afterwards, the program asks for two inputs from the user and prints out the result of the two numbers given which operation the user selected.   After printing the result, loop back to asking the user to select a function again until he enters 5 to exit the program. Try to complete this task using methods for each function and using loops.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter4: Selection Structures
Section4.5: A Case Study: Solving Quadratic Equations
Problem 2E
icon
Related questions
Question

Command Line Calculator

 

The program will ask the user to select a function from 1-5 (1-Add, 2-Subtract, 3-Multiply, 4- Divide, 5-Exit the program). Afterwards, the program asks for two inputs from the user and prints out the result of the two numbers given which operation the user selected.

 

After printing the result, loop back to asking the user to select a function again until he enters 5 to exit the program. Try to complete this task using methods for each function and using loops.

Please select from below choices:
1 - Add
2 - Subtract
3 - Multiply
4 - Divide
5 Exit the program
Please enter your choice: 1
Enter first number: 44
Enter second number: 27
Result: 71
Please select from below choices:
2 - Subtract
3 - Multiply
4 - Divide
5 Exit the program
Please enter your choice:
Result: 8
Please select from below choices:
1 - Add
2 - Subtract
3- Multiply
4 - Divide
5 - Exit the program
Please enter your choice:
Will now exit the program.
Transcribed Image Text:Please select from below choices: 1 - Add 2 - Subtract 3 - Multiply 4 - Divide 5 Exit the program Please enter your choice: 1 Enter first number: 44 Enter second number: 27 Result: 71 Please select from below choices: 2 - Subtract 3 - Multiply 4 - Divide 5 Exit the program Please enter your choice: Result: 8 Please select from below choices: 1 - Add 2 - Subtract 3- Multiply 4 - Divide 5 - Exit the program Please enter your choice: Will now exit the program.
Expert Solution
steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Knowledge Booster
Concept of memory addresses in pointers
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
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L
CMPTR
CMPTR
Computer Science
ISBN:
9781337681872
Author:
PINARD
Publisher:
Cengage
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning