Don't know if its the ideal solution...but it works
Code:#include <stdio.h> int main() { int number; printf("Enter an integer:"); if (scanf("%[0-9]d", &number)!=1) { printf("You didn't type in a number"); getchar(); } return 0; }
Don't know if its the ideal solution...but it works
Code:#include <stdio.h> int main() { int number; printf("Enter an integer:"); if (scanf("%[0-9]d", &number)!=1) { printf("You didn't type in a number"); getchar(); } return 0; }
"Service of the poor and destitutes is the service of the God"
Normative Changes to ISO/IEC 9899:1990 in Technical Corrigendum 1
Incompatibilities Between ISO C and ISO C++