Source : http://stackoverflow.com/questions/784563/c-check-whether-is-number-is-int-float/784825
#include
using namespace std;
int main(){
double num1;
cin»num1;
if(static_cast(num1) == num1)//casts num1 to type int
cout«"Integer"<
else
cout«"Not Integer"<
return 0;
}
Another method is
char *test = "asdf1234";
int i;
for (i = 0; i < strlen (test); i++)
{ if (isdigit (test[i]))fprintf (stdout, "test[%d] is a digit!\n", i);
}