Hi guys, here is the code:
What I want to do is check the user's input to make sure it's a number, if it's not a number I want it to display that message (Invalid Entry. Not a number! Program Terminating) and kill the program.
int iYearBorn = 0;
printf("\nEnter year born, either 2000, 2001, 2002: ");
if (isdigit(iYearBorn) == 0)
printf("\nInvalid Entry. Not a number! Program Terminating.\n");
printf("\n2000 is the year of luck!\n");
printf("\nPeace be with you 2001\n");
printf("\n2002 is uber leet pwnage dudez\n");
printf("\nNo data on that year!\n");
If it is a number I want it to continue on down to the switch statement etc, but the problem is, whenever I run it, no matter what the user input is, it ALWAYS says "Invalid Entry. Not a number! Program Terminating" and kills the program, even if I enter a number... so I'm assuming i'm using the isdigit function wrong somehow, if anyone could help me out that'd be great. Thanks!