diff --git a/cv1/program.c b/cv1/program.c index b02c0b4..01ad4b1 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -6,7 +6,6 @@ #define MAX_LENGTH 100 void decode_hacker_script(const char *input, char *output) { - int j = 0; for (int i = 0; input[i]; i++) { char c = tolower(input[i]); @@ -32,24 +31,22 @@ int main() { printf("Zadaj hladanu surovinu:\n"); scanf("%s", search_item); decode_hacker_script(search_item, decoded_search); + + while (getchar() != '\n'); printf("Zadaj jedalny listok:\n"); while (1) { - if (fgets(menu_item, sizeof(menu_item), stdin) == NULL || strlen(menu_item) == 0) { break; } - menu_item[strcspn(menu_item, "\n")] = 0; - if (fgets(price, sizeof(price), stdin) == NULL || strlen(price) == 0) { - break; - + break; + } price[strcspn(price, "\n")] = 0; - decode_hacker_script(menu_item, decoded_item); if (strstr(decoded_item, decoded_search) != NULL) { @@ -58,9 +55,7 @@ int main() { } } - printf("Nacitanych %d poloziek.\n", count); return 0; } -} \ No newline at end of file