From c53b20e10bca382fbf864121f6c68fb07c5fbb40 Mon Sep 17 00:00:00 2001 From: Yurii Chechur Date: Mon, 30 Sep 2024 11:43:55 +0000 Subject: [PATCH] Delete program.c --- program.c | 77 ------------------------------------------------------- 1 file changed, 77 deletions(-) delete mode 100644 program.c diff --git a/program.c b/program.c deleted file mode 100644 index 0e85f3f..0000000 --- a/program.c +++ /dev/null @@ -1,77 +0,0 @@ -#include -#include - - -void replace(char* DishName); - -struct MenuItem { - char category[50]; - char dish[50]; - float price; -}; - -char answer1[100]; - -int main(void) { - - - struct MenuItem menu[] = { - {"Pizza", "Margarita", 4.4}, - {"Pizza", "Cucumber", 4.4}, - {"Pizza", "Ajika", 4.4}, - {"Pizza", "Paperoni", 4.4} - }; - - - printf("Zadaj hladanu surovinu: "); - fgets(answer1, 100, stdin); - - - if (answer1[strlen(answer1) - 1] == '\n') { - answer1[strlen(answer1) - 1] = '\0'; - } - - int MenuSize = sizeof(menu) / sizeof(menu[0]); - int found = 0; - - - for (size_t i = 0; i < MenuSize; i++) { - - if (strstr(menu[i].dish, answer1) != NULL) { - found = 1; - - replace(menu[i].dish); - printf("Chcete to to: %s, Cena: %.2f\n", menu[i].dish, menu[i].price); - } - } - - - if (!found) { - printf("Zadana surovina nebola najdena.\n"); - } - - return 0; -} - - -void replace(char* DishName) { - - char original[] = "aAeEiIoOsSzZ"; - - char replacement[] = "443311005522"; - - int l = strlen(DishName); - - - for (int i = 0; i < l; i++) { - - for (int j = 0; j < strlen(original); j++) { - if (DishName[i] == original[j]) { - - DishName[i] = replacement[j]; - break; - } - } - } -} -