1sssaaaaaaadsdsd
This commit is contained in:
parent
82cc39f15b
commit
5377b221f9
@ -48,5 +48,42 @@ void run(Node* n) {
|
||||
printf("%s", n->text);
|
||||
|
||||
if (n->text[0] == '*') {
|
||||
printf("Kon
|
||||
printf("Koniec\n");
|
||||
return;
|
||||
}
|
||||
|
||||
char c;
|
||||
if (scanf(" %c", &c) != 1) {
|
||||
printf("Nespravny vstup.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (c == 'a') n = n->left;
|
||||
else if (c == 'n') n = n->right;
|
||||
else {
|
||||
printf("Nespravny vstup.\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
||||
Node* root = read_tree();
|
||||
|
||||
if (!root) {
|
||||
printf("Chyba: nepodarilo sa nacitat bazu pravidiel.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int items = count_leafs(root);
|
||||
|
||||
printf("Expert z bufetu to vie.\n");
|
||||
printf("Pozna %d druhov ovocia a zeleniny.\n", items);
|
||||
|
||||
run(root);
|
||||
|
||||
destroy_tree(root);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user