Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //which one is preferable form to use?
- //that's the first one
- do //makes sure that scanf puts float into temp
- {
- printf("How much of artishoks do you want?\n");
- sc_res= scanf("%f",&temp);
- if(!sc_res)
- scanf("%*s");
- }while(!sc_res);
- //that's the second one
- printf("How much of artishoks do you want?\n");
- sc_res= scanf("%f",&temp);
- while(!sc_res) //makes sure that scanf puts float into temp
- {
- scanf("%*s");
- printf("How much of artishoks do you want?\n");
- sc_res= scanf("%f",&temp);
- }
Advertisement
Add Comment
Please, Sign In to add comment