Обновить cv1/program.c

This commit is contained in:
Yevhen Kozirovskyi 2024-10-02 17:00:34 +00:00
parent f61d976748
commit e80e1a83fe

View File

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