this post is probably a bit different from the usual questions about exceptions in c++. I hope i'm not wasting people's time with my seemingly obvious questions but i'm struggling to understand what i'm about to ask when reaching out to the obvious sources of knowledge before one would directly ask for help in understanding a concept.
My question is this, in c++, how does someone go about handling user input errors, by this specifically i mean when a user is being prompted for an integer and they enter a float or a string/char or vice versa. You know like someone entering their name when being prompted for their age or something.
I'm basically talking about c++'s equivilent to what would be in python something like:
try:
[code to prompting user for an integer.]
exception ValueError:
[code to run if exception is thrown.]
Now i know i'm probably going to get alot of face-palming because this seems like such a basic concept of programming but i'm having trouble understanding how to go about this in c++.
If one of you awesome guys has the spare time to explain this to me in a way a beginner would be able to understand it would be hugely appreciated guys. As this is something i'm getting frustrated with, it should be very simply i would have thought, perhaps my researching skills need work.
Thankyou in advance people and once again i'm very sorry for any time i've wasted with my noob-ass question. But i just want to learn, and would mean alot if someone could help me out here.
Thanks.