Обновить cv1/program.c

This commit is contained in:
Yevhen Kozirovskyi 2024-10-03 11:09:42 +00:00
parent 432668568e
commit 3b299071d6

View File

@ -33,16 +33,18 @@ int main() {
decode(slovo); decode(slovo);
printf("Zadaj jedalny listok:\n"); printf("Zadaj jedalny listok:\n");
while (1) { while (1) {
if (fgets(dish_name, MAX_LENGTH, stdin) == NULL || strcmp(dish_name, "\n") == 0) { if (fgets(dish_name, MAX_LENGTH, stdin) == NULL || strcmp(dish_name, "\n") == 0) {
break; break;
} }
dish_name[strcspn(dish_name, "\n")] = 0; dish_name[strcspn(dish_name, "\n")] = 0;
// Read the price as a float
if (scanf("%f", &price[count]) != 1) { if (scanf("%f", &price[count]) != 1) {
break; break;
} }
// Clear the newline character left in the input buffer
while (getchar() != '\n'); while (getchar() != '\n');
char normal_dish[MAX_LENGTH]; char normal_dish[MAX_LENGTH];
strcpy(normal_dish, dish_name); strcpy(normal_dish, dish_name);
decode(normal_dish); decode(normal_dish);