From 828b632b59f7e6123a6a6598a689bd5f45fefbf5 Mon Sep 17 00:00:00 2001 From: Kozar Date: Wed, 2 Oct 2024 18:36:14 +0000 Subject: [PATCH] Initializacia --- cv1/program.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/cv1/program.c b/cv1/program.c index f7fdf7b..0e8d7d5 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -4,7 +4,6 @@ #define MAX_INPUT_LENGTH 100 -// Define the "Hack3r scr1pt" mapping char hack3r_script_mapping[][2] = { {'0', 'o'}, {'1', 'i'}, @@ -23,23 +22,19 @@ int main() { char menu_item[MAX_INPUT_LENGTH]; int count = 0; - // Read the ingredient to be searched printf("Zadaj hladanu surovinu: "); fgets(ingredient, MAX_INPUT_LENGTH, stdin); - ingredient[strcspn(ingredient, "\n")] = 0; // Remove newline character + ingredient[strcspn(ingredient, "\n")] = 0; - printf("Zadaj jedalny listok:\n"); // Print the prompt + printf("Zadaj jedalny listok:\n"); - // Read the menu items while (1) { - printf("Zadaj jedalny listok: "); // Print the prompt for each menu item fgets(menu_item, MAX_INPUT_LENGTH, stdin); if (feof(stdin) || strlen(menu_item) == 1) { break; } - menu_item[strcspn(menu_item, "\n")] = 0; // Remove newline character + menu_item[strcspn(menu_item, "\n")] = 0; - // Apply the "Hack3r scr1pt" mapping to the name char name_hack3r[MAX_INPUT_LENGTH]; int j = 0; for (int i = 0; menu_item[i]; i++) { @@ -57,14 +52,12 @@ int main() { } name_hack3r[j] = 0; - // Search for the ingredient in the name if (strstr(name_hack3r, ingredient) != NULL) { printf("%s\n", menu_item); count++; } } - // Display the count of successful searches printf("Nacitanych %d poloziek.\n", count); return 0;