This commit is contained in:
Valér Jakubčo 2021-10-07 20:18:08 +02:00
parent 6d745dc623
commit 62a4fabcf9

View File

@ -21,7 +21,7 @@ int main(){
char sign[] = {'o','i','z','e','a','s','b','t','b','q'};
char secret[]={'0','1','2','3','4','5','6','7','8','9'};
char input_search[20];
char input_search[50];
//initialize input_search
struct item menu[NUMBER_OF_MEALS];
struct backup_item backup_menu[NUMBER_OF_MEALS];
@ -34,7 +34,7 @@ int main(){
//}
printf("Zadaj hladanu surovinu: ");
printf("Zadaj hladanu surovinu:\n");
fgets (input_search, 20, stdin);
printf("Zadaj jedalny listok:\n");
@ -43,19 +43,22 @@ int main(){
//initialize temp
int meal_counter = 0;
//load menu
char* ptr = NULL;
while(1){
fgets (menu[meal_counter].name, 20, stdin);
if(menu[meal_counter].name[0] == '\n'){
ptr = fgets (menu[meal_counter].name, 20, stdin);
if(ptr == NULL){
break;
}
if(menu[meal_counter].name[0] == '\n'){
break;
}
fgets (temp, 10, stdin);
fgets (temp, 20, stdin);
menu[meal_counter].price = strtof(temp, NULL);
meal_counter++;
}
//make copy of menu
for (int i = 0 ; i < meal_counter; i++){
strcpy(backup_menu[i].name, menu[i].name);