How to deal with non-number inputs?

Re: How to deal with non-number inputs?

by Ramses van Zon -
Number of replies: 0
To be resilient against non-number inputs is a bit tricky, you'd need to first read in a string, then try to convert it to a double with std::stod while catching exceptions that std::stod may throw. It won't throw an exception if it looks like an int, in that case it will just store the integer value in the double.