Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Download: https://solutionzip.com/downloads/simpleoperations/
- For this program, ask the user for the following:
- • Input a number that you will treat as an integer.
- • The calculation the user wants to perform that is chosen from one of the following operations:
- o + (addition)
- o – (subtraction)
- o * (multiplication) o / (division)
- o %(mod)
- • A second number also treated as an integer. Store the calculation choice in a char variable.
- Using a switch statement, switch on the char variable to perform the calculation. The switch statement should have a default block that prints out an error message if the user enters anything other than ‘+’, ‘- ‘, ‘*’, ‘%’, or ‘/’.
- Save the result in a variable called answer.
- Finally, put all of this into the body of a for loop that repeats six times.
- You must provide good prompts to the user and check for any error conditions before performing the operations.
- Finally, make sure you comment your code. At the top of the .cpp file, you must include at a least the following: name, class and section number, date, and purpose.
- Download: https://solutionzip.com/downloads/simpleoperations/
Add Comment
Please, Sign In to add comment