Question
In C++. Write a program that will enable a user to do simple mathematical calculations. You must do it from scratch - don't forget the
In C++. Write a program that will enable a user to do simple mathematical calculations. You must do it from scratch - don't forget the magic!
It will need to do the following: 1. Prompt the user with the following string: "1) addition 2) subtraction 3) multiplication 4) division: " 2. Input their choice into an integer variable named whatever you want. 3. Prompt them with the following string: "Please enter two numbers: " 4. Input two integers from the keyboard into two variables called whatever you want. 5. Do the math of their choice (i.e. if they typed 3 9 6, you will subtract (choice 3) 9 and 6). 6. Output the result to the screen and quit.
7. Validate the input - NO DIVISION BY ZERO (or modulus by zero) and check to make sure they typed a number between 1 and 4 for the operator. If they gave a bad input: output "BAD INPUT!" and quit. 8. Add modulus as option #5. Don't change the prompt (in #1), it will be a secret easter egg. Also modify #7 so it doesn't output BAD INPUT! on a 5.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started