Обновить cv1/program.c
This commit is contained in:
parent
e80e1a83fe
commit
2a868dd92b
@ -38,6 +38,7 @@ int main() {
|
|||||||
if (fgets(name, MAX_NAME_LEN, stdin) == NULL) {
|
if (fgets(name, MAX_NAME_LEN, stdin) == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
name[strcspn(name, "\n")] = '\0';
|
||||||
|
|
||||||
if (strlen(name) == 0) {
|
if (strlen(name) == 0) {
|
||||||
break;
|
break;
|
||||||
@ -45,6 +46,7 @@ int main() {
|
|||||||
if (fgets(price, MAX_NAME_LEN, stdin) == NULL) {
|
if (fgets(price, MAX_NAME_LEN, stdin) == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
price[strcspn(price, "\n")] = '\0';
|
||||||
|
|
||||||
strncpy(dishes[count][0], name, MAX_NAME_LEN - 1);
|
strncpy(dishes[count][0], name, MAX_NAME_LEN - 1);
|
||||||
dishes[count][0][MAX_NAME_LEN - 1] = '\0';
|
dishes[count][0][MAX_NAME_LEN - 1] = '\0';
|
||||||
@ -65,7 +67,9 @@ int main() {
|
|||||||
|
|
||||||
if (strstr(decoded_name, ingredient) != NULL) {
|
if (strstr(decoded_name, ingredient) != NULL) {
|
||||||
printf("%s%s", dishes[i][0], dishes[i][1]);
|
printf("%s%s", dishes[i][0], dishes[i][1]);
|
||||||
|
if (i < count - 1) {
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("Nacitanych %d poloziek.", count);
|
printf("Nacitanych %d poloziek.", count);
|
||||||
|
Loading…
Reference in New Issue
Block a user