Compare commits
2 Commits
f5ffb2ffde
...
4099b4e7ce
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4099b4e7ce | ||
|
|
c979111484 |
@ -79,13 +79,13 @@ void run_system(Tree *node) {
|
|||||||
|
|
||||||
// list -> koniec
|
// list -> koniec
|
||||||
if (!node->left && !node->right) {
|
if (!node->left && !node->right) {
|
||||||
printf("Koniec\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
char c;
|
int c = getchar();
|
||||||
if (scanf(" %c", &c) != 1) {
|
|
||||||
printf("Nerozumiem\n");
|
if (c == EOF) {
|
||||||
|
printf("Koniec vstupu\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ void run_system(Tree *node) {
|
|||||||
} else if (c == 'n') {
|
} else if (c == 'n') {
|
||||||
run_system(node->right);
|
run_system(node->right);
|
||||||
} else {
|
} else {
|
||||||
printf("Nerozumiem\n");
|
printf("Koniec vstupu\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,14 +103,14 @@ int main() {
|
|||||||
|
|
||||||
// nepodarilo sa nacitat koren -> chyba
|
// nepodarilo sa nacitat koren -> chyba
|
||||||
if (!root) {
|
if (!root) {
|
||||||
printf("Chyba\n");
|
printf("Koniec vstupu\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// skontrolovat prazdny riadok
|
// skontrolovat prazdny riadok
|
||||||
char buffer[SIZE];
|
char buffer[SIZE];
|
||||||
if (!fgets(buffer, SIZE, stdin) || strcmp(buffer, "\n") != 0) {
|
if (!fgets(buffer, SIZE, stdin) || strcmp(buffer, "\n") != 0) {
|
||||||
printf("Chyba\n");
|
printf("Koniec vstupu\n");
|
||||||
destroy_tree(root);
|
destroy_tree(root);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user