Question: Implement a NotAnInteger Exception that handles the error that occurs when trying to store anything that isn't an integer in an integer variable. You should

 Implement a NotAnInteger Exception that handles the error that occurs when

Implement a NotAnInteger Exception that handles the error that occurs when trying to store anything that isn't an integer in an integer variable. You should take the user input as a string and then ensure it is made up only of digits. If it is, convert it to an integer using the string::stoi(). If it does contain anything that is not a digit, throw the custom exception. Also write a main function with the proper try-catch blocks

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!