|
This is missleading... But I guess C++ is ugly that way..
A small test revealed, if the input isn't an int, the int value will be set to less than INT_MIN/2 So the disturbing part is, what if the user chose to input INT_MIN+2 then we can't be sure wether its a valid input or not... Not even errno is set to anything..
Oddly enough, theres alot of setf() flags, that can turn input into truely boolean or decimal but none defined for a simple int...
Guess the last thing todo, is use a fscanf() on stdin, to make sure its a valid int you're getting..
|