pridanie podmienky pre zle nacitanie

This commit is contained in:
Valér Jakubčo 2021-10-14 16:38:47 +02:00
parent ca874baf8d
commit 788b9ca2fa

View File

@ -56,7 +56,7 @@ int main(){
} }
ptr2 = fgets(temp, 20, stdin); ptr2 = fgets(temp, 20, stdin);
food_database[meal_counter].price = strtof(temp, NULL); food_database[meal_counter].price = strtof(temp, NULL);
if ( ptr2 == NULL ){ if ( ptr2 == NULL || food_database[meal_counter].price == 0){
break; break;
} }
meal_counter++; meal_counter++;