This commit is contained in:
Weber 2024-09-29 08:24:35 +00:00
parent 8be67479fc
commit f2f053aa41

View File

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