#include #include #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); surovina[strcspn(surovina, "\n")] = '\0'; for(int j = 0; j <= strcspn(surovina, "\0");j++){ for(int x = 0; x < 11;x++){ if(surovina[j] == numbers[x]){ surovina[j] = letters[x]; } if(isupper(surovina[j])){ surovina[j] = tolower(surovina[j]); } } } 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]; } if(isupper(menu[i].name[j])){ menu[i].name[j] = tolower(menu[i].name[j]); } } } } char *istr; for(int i = 0; i <= count;i++){ istr = strstr(menu[i].name, surovina); if(istr != NULL){ printf("%s\n", menu1[i].name); float number = strtof(menu1[i].price, NULL); printf("%.2f\n", number); } } printf("Nacitanych %d poloziek.\n", count); return 0; }