The program outputs "Input failed" if user types in "hello" or a very long number. So how do I differentiate between the two reason the input failed so that I can give a better error message?
If the input is not a valid number a is set to zero
If the number is too large a is set to std::numeric_limits<int>::max() (the maximum value that an int can handle).
If the number is too small a is set to std::numeric_limits<int>::min().