Initializacia
This commit is contained in:
parent
e913bf53ed
commit
828b632b59
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#define MAX_INPUT_LENGTH 100
|
#define MAX_INPUT_LENGTH 100
|
||||||
|
|
||||||
// Define the "Hack3r scr1pt" mapping
|
|
||||||
char hack3r_script_mapping[][2] = {
|
char hack3r_script_mapping[][2] = {
|
||||||
{'0', 'o'},
|
{'0', 'o'},
|
||||||
{'1', 'i'},
|
{'1', 'i'},
|
||||||
@ -23,23 +22,19 @@ int main() {
|
|||||||
char menu_item[MAX_INPUT_LENGTH];
|
char menu_item[MAX_INPUT_LENGTH];
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
// Read the ingredient to be searched
|
|
||||||
printf("Zadaj hladanu surovinu: ");
|
printf("Zadaj hladanu surovinu: ");
|
||||||
fgets(ingredient, MAX_INPUT_LENGTH, stdin);
|
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) {
|
while (1) {
|
||||||
printf("Zadaj jedalny listok: "); // Print the prompt for each menu item
|
|
||||||
fgets(menu_item, MAX_INPUT_LENGTH, stdin);
|
fgets(menu_item, MAX_INPUT_LENGTH, stdin);
|
||||||
if (feof(stdin) || strlen(menu_item) == 1) {
|
if (feof(stdin) || strlen(menu_item) == 1) {
|
||||||
break;
|
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];
|
char name_hack3r[MAX_INPUT_LENGTH];
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for (int i = 0; menu_item[i]; i++) {
|
for (int i = 0; menu_item[i]; i++) {
|
||||||
@ -57,14 +52,12 @@ int main() {
|
|||||||
}
|
}
|
||||||
name_hack3r[j] = 0;
|
name_hack3r[j] = 0;
|
||||||
|
|
||||||
// Search for the ingredient in the name
|
|
||||||
if (strstr(name_hack3r, ingredient) != NULL) {
|
if (strstr(name_hack3r, ingredient) != NULL) {
|
||||||
printf("%s\n", menu_item);
|
printf("%s\n", menu_item);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display the count of successful searches
|
|
||||||
printf("Nacitanych %d poloziek.\n", count);
|
printf("Nacitanych %d poloziek.\n", count);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user