Hello guys. For my final exam this year I must do a program, but I must protect it from dumb people. For example, I ask the user to enter an int, but he enters something like
dfsadfa
or
+*+-/*-
. I've heard that one way to prevent the user to make my program fail with such an input would be to use function
cin.fail()
. The thing is that i'm a very beginner and don't know what the stream nor the buffer is, so i don't know if i'm writing the code properly. Could you take a look at the following code to see if that's the structure i should use: