Question
C++ program that will read in 2 different numbers for the operands and an operator. It should handle errors when the user doesn't enter a
C++ program that will read in 2 different numbers for the operands and an operator. It should handle errors when the user doesn't enter a number or a negative value by repeatedly printing out an error message and ask for a new number. Also, if the user enters an unsupported operator, it will constantly ask for a new operator. Requirements: - It will continue to ask for a new number if that number does not meet the required rules - The program must produce the expected sample output including spacing and alignment - No global variables - It should also handle input error where the user enters a non-numerical value such as "abc" or a negative value such as 1 for the operator and/or the user enters an unsupported operator. It only supports '+', '-', '*', '/' or '%' operator. - The program must print out a clear informational message for the error to help the user to correct the value.
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