#define LINE_SIZE 100 #define POCET_JEDAL 100000 #include #include #include #include struct pizza { float prize; char name[LINE_SIZE]; }; struct pizza jedalny_listok[POCET_JEDAL]; struct pizza *prva = jedalny_listok; struct pizza *druha = jedalny_listok + 1; struct pizza *tretia = &jedalny_listok[2]; char hacker_script(char c) { if (isupper(c)) { return (char) tolower(c); } const char numbers[] = "0123456789"; const char letters[] = "oizeasbtbq"; for (int i = 0; i < 10; i++) { if (c == numbers[i]) { return letters[i]; } } return c; } int read_pizza(struct pizza *item) { char line[LINE_SIZE]; char line2[LINE_SIZE]; char *endptr; float value = strtof(line2, &endptr); if (value == 0.0F) return 0; strcpy(item->name, line); item->prize = value; return 1; } int search_string(const char* heap, const char* needle) { int heap_len = strlen(heap); int needle_len = strlen(needle); for (int i = 0; i <= heap_len - needle_len; i++) { int j; for (j = 0; j < needle_len; j++) { char perm_n = hacker_script(needle[j]); char perm_h = hacker_script(heap[i + j]); if ((perm_n == '6' && perm_h == '8') || (perm_n == '8' && perm_h == '6')) { continue; } if (perm_n != perm_h) { break; } } if (j == needle_len) { return i; } } return -1; } int main() { printf("Zadaj hladanu surovinu:\n"); char search[LINE_SIZE]; if (!fgets(search, sizeof(search), stdin)) { return 1;} search[strcspn(search, "\n")] = '\0'; printf("Zadaj jedalny listok:\n"); int loaded = 0; while (loaded < POCET_JEDAL && read_pizza(&jedalny_listok[loaded])) { loaded++; } for(int i = 0; i