From 12235c8914a03bc8006ffedd033d662d8997e7a6 Mon Sep 17 00:00:00 2001 From: Matej Hajduk Date: Wed, 24 Sep 2025 14:29:03 +0200 Subject: [PATCH] aa --- du1/program.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/du1/program.c b/du1/program.c index a5e2934..1ebdc3e 100644 --- a/du1/program.c +++ b/du1/program.c @@ -6,23 +6,20 @@ // meni cisla na znaky a aj velke na male void normalize(char *z) { - char cis[] = "013456789"; - char pis[] = "oieasgtbq"; + char cis[] = "0123456789"; + char pis[] = "oizeasgtbq"; for (int i = 0; z[i]; i++) { - char x = tolower(z[i]); + char x = tolower((unsigned char)z[i]); - int found = 0; - for (int j = 0; j < 9; j++) { + for (int j = 0; j < 10; j++) { if (x == cis[j]) { z[i] = pis[j]; found = 1; break; } } - - //na male pismeno if (!found) { z[i] = x; } @@ -31,7 +28,6 @@ void normalize(char *z) { int main() { char h[LINE_SIZE]; - char line[LINE_SIZE]; char j[LINE_SIZE]; char price[LINE_SIZE]; int count = 0; @@ -46,15 +42,19 @@ int main() { if (!fgets(j, LINE_SIZE, stdin)) break; j[strcspn(j, "\n")] = 0; if (strlen(j) == 0) break; + if (!fgets(price, LINE_SIZE, stdin)) break; price[strcspn(price, "\n")] = 0; + + count++; // počítame všetky položky + char norm_dish[LINE_SIZE]; strcpy(norm_dish, j); normalize(norm_dish); + if (strstr(norm_dish, h) != NULL) { printf("%s\n", j); printf("%s\n", price); - count++; } }