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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!