program skipping scanf code example
Example: code in c skipping over scanf
bool isDigit(char num)
{
if(num>='0' && num<='9')
{
return true;
}
}
int main (void)
{
char user1 = 0;
char ch;
printf ("*****************************************"
"\n* Character Arithmetic *"
"\n*****************************************"
"\n* Program instructions here *"
"\n* Program instructions here *"
"\n*****************************************"
"\n* Functions: *"
"\n* a. isDigit *"
"\n* b. isLetter *"
"\n* c. toUpper *"
"\n* d. toLower *"
"\n* q. Quit *"
"\n*****************************************");
printf (" Choose a function: ");
scanf ("%c", &user1);
printf ("Enter a character you would like to use the function on: \n");
scanf ("%c", &ch);
if ( user1 == 'a' && isDigit(ch) )
{
printf ("%c is a digit!\n", ch);
}
}