diff --git a/cv7/program.c b/cv7/program.c index 970b30e..2b9e617 100644 --- a/cv7/program.c +++ b/cv7/program.c @@ -36,13 +36,14 @@ struct tree* load_tree() { return node; } -void print_tree(struct tree* tree, int offset) { +void run_tree(struct tree* tree) { if (!tree) { return; } if (tree->value[0] == '*') { printf("Expert z bufetu to vie.\n%s\nKoniec\n", tree->value + 1); + printf("*"); return; } @@ -55,9 +56,9 @@ void print_tree(struct tree* tree, int offset) { } if (response == 'a') { - print_tree(tree->left, offset + 3); + run_tree(tree->left); } else { - print_tree(tree->right, offset + 3); + run_tree(tree->right); } } @@ -92,7 +93,7 @@ int main() { printf("Pozna %d druhov ovocia a zeleniny.\n", count); printf("Odpovedajte 'a' pre prvu moznost alebo 'n' pre druhu moznost.\n"); - print_tree(root, 0); + run_tree(root); destroy_tree(root); return 0;