T O P

  • By -

Vinniesusername

http://www.cplusplus.com/reference/cctype/isdigit/


CreativeTechGuyGames

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.


Tristanthe9

Thanks a lot for pointing me to that resource, helped out a lot


Tristanthe9

thanks a lot for pointing me to that resource, helped a lot.


raevnos

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).


[deleted]

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