This commit is contained in:
Ivan Leichenko 2024-11-15 06:28:57 +01:00
parent a3c65d5786
commit c46c5efb01

View File

@ -92,15 +92,14 @@ void interact(struct tree *node)
char answer[SIZE]; char answer[SIZE];
while (fgets(answer, SIZE, stdin)) while (fgets(answer, SIZE, stdin))
{ {
answer[strcspn(answer, "\n")] = 0; if (answer[0] == '\n')
if (answer[0] == '\0')
{ {
printf("Koniec vstupu\n"); printf("Koniec vstupu\n");
return; return;
} }
answer[strcspn(answer, "\n")] = 0;
if (strcmp(answer, "a") == 0) if (strcmp(answer, "a") == 0)
{ {
interact(node->left); interact(node->left);