if (!strcmp(yn, "y")) {
isCooked[x] = 1;
printf("How much %s (in grams) will you cook? ", food[choice - 1]);
} else {
isCooked[x] = 0;
printf("How much %s (in grams) will you eat raw? ", food[choice - 1]);
}
scanf("%f", &grams);
userGrams[x] = grams;
Where should I put my if-else statement if I want to control the user input of grams? I want to put restrictions on my program, like the user should only input minmimum of 20g and the maximum of 200g.
Aucun commentaire:
Enregistrer un commentaire