-
isdigit function
Hi I hope someone can help me with this. I am working on a program that asks the user to select an item from the menu 1-6. I have a while statement that returns to the loop if the user selects any other number. while(userAns<1)||(userAns>6)) I am trying to create an isdigit if statement that will return to the loop if the user selects a char. I have: if(isdigit(c)) I declared my char c, and have the #include<ctype.h> Should the while statement and the if statement be together? The while statement works but the if just loops. Thanks [EMAIL=joejonsmom]function isdigit What am I missing?
-
You could help us help you by posting your attempt so we can have a look at it and see if you are doing things right or wrong.
~/
-
isdigit
Hi actually I got this to work finally but now my if statement to make the loop work is not.
}
printf("Would you like to select another option?\n\n");
printf("1=Yes and 2=No\n\n",ans);
scanf("%d",&ans);
if(ans==1)
clrsc();
else if(ans!=1)
return 0;
}
I know this is something really easy but I appreciate any help I can get. Thanks
-
Code:
printf("1=Yes and 2=No\n\n",ans); // Why?
-
if loop
I need a loop which gives the user an option to exit or return to the menu to select another currency.
What would be a better option Thanks
-
Perhaps this old post may be of interest.