From e80e1a83fef0fd9ecb6098680a2d1c2de8fc307c Mon Sep 17 00:00:00 2001 From: Yevhen Kozirovskyi Date: Wed, 2 Oct 2024 17:00:34 +0000 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20cv1/program.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cv1/program.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/cv1/program.c b/cv1/program.c index d6762e9..808b531 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -38,7 +38,6 @@ int main() { if (fgets(name, MAX_NAME_LEN, stdin) == NULL) { return 0; } - name[strcspn(name, "\n")] = '\0'; if (strlen(name) == 0) { break; @@ -46,7 +45,6 @@ int main() { if (fgets(price, MAX_NAME_LEN, stdin) == NULL) { return 0; } - price[strcspn(price, "\n")] = '\0'; strncpy(dishes[count][0], name, MAX_NAME_LEN - 1); dishes[count][0][MAX_NAME_LEN - 1] = '\0'; @@ -66,12 +64,10 @@ int main() { decodovane_slovo(decoded_name); if (strstr(decoded_name, ingredient) != NULL) { - printf("%s\n%s", dishes[i][0], dishes[i][1]); - if (i < count - 1) { - printf("\n"); - } + printf("%s%s", dishes[i][0], dishes[i][1]); + } } - printf("Nacitanych %d poloziek.\n", count); + printf("Nacitanych %d poloziek.", count); return 0; }