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; }