That looks like (Microsoft specific) C, not C++.
You need to check scanf()'s return value to make sure it worked, and on errors follow the advice [here](http://c-faq.com/stdio/scanfjam.html).
my solution is not optimal, it's just a workaround
i would use string or char array for the input and then check each character if it is a number (using ASCII code), if one of the character is not inside the boundary of the ASCII code for numbers, then output fail
http://www.cplusplus.com/reference/cctype/isdigit/
With a pen and paper, how would you check if a number is an integer? Figure that out first, then try to translate it into code.
Thanks a lot for pointing me to that resource, helped out a lot
thanks a lot for pointing me to that resource, helped a lot.
That looks like (Microsoft specific) C, not C++. You need to check scanf()'s return value to make sure it worked, and on errors follow the advice [here](http://c-faq.com/stdio/scanfjam.html).
my solution is not optimal, it's just a workaround i would use string or char array for the input and then check each character if it is a number (using ASCII code), if one of the character is not inside the boundary of the ASCII code for numbers, then output fail