#include #include #define LINESIZE 100 struct pizza { char price[LINESIZE]; char name[LINESIZE]; }; int main(){ char surovina[LINESIZE]; char vstup[LINESIZE]; struct pizza menu[LINESIZE]; struct pizza menu1[LINESIZE]; char numbers[] = "0123456789"; char letters[] = "oizeasbtbq"; printf("Zadaj hladanu surovinu:\n"); fgets(surovina,LINESIZE,stdin); printf("Zadaj jedalny listok:\n"); int count = 0; while (count < LINESIZE) { if (fgets(vstup, LINESIZE, stdin)) { vstup[strcspn(vstup, "\n")] = '\0'; if (strlen(vstup) == 0) { break; } strcpy(menu[count].name, vstup); strcpy(menu1[count].name, vstup); } else { break; } if (fgets(vstup, LINESIZE, stdin)) { vstup[strcspn(vstup, "\n")] = '\0'; if (strlen(vstup) == 0) { break; } strcpy(menu[count].price, vstup); strcpy(menu1[count].price, vstup); } else { break; } count++; } for(int i = 0; i < count;i++){ for(int j = 0; j <= strlen(menu[i].name);j++){ for(int x = 0; x <= 11;x++){ if(menu[i].name[j] == numbers[x]){ menu[i].name[j] = letters[x]; } } } } int odpoved = -1; for(int i = 0; i <= count && odpoved == -1;i++){ for(int j = 0; j <= strlen(menu[i].name);j++){ for(int x = 0; x <= strlen(surovina);x++){ if(surovina[x] != menu[i].name[j]){ break; } odpoved = i; } } } if(odpoved == -1){ printf("chyba"); } else{ printf("%s\n", menu1[odpoved].name); printf("%s\n", menu1[odpoved].price); } printf("Nacitanych %d poloziek.\n", count); return 0; }