From e3a7bb990a00e79f25e78f3a142dba984ca94d63 Mon Sep 17 00:00:00 2001 From: Maryna Kravtsova Date: Sun, 22 Nov 2020 17:23:42 +0100 Subject: [PATCH] buffet --- cv8/program.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/cv8/program.c b/cv8/program.c index c62f3dc..36d9a8a 100644 --- a/cv8/program.c +++ b/cv8/program.c @@ -44,7 +44,8 @@ void search(struct tree* this){ if(r == NULL){ printf("Koniec vstupu\n"); exit(0); - } + } + if(buffer[0] != '\n'){ if(buffer[0] == 'a'){ if(this->left->value[0] == '*'){ printf("%s\n", this->left->value); @@ -66,10 +67,11 @@ void search(struct tree* this){ search(this->right); } - else if(buffer[0] != 'a' || buffer[0] != 'n'){ - printf("Nerozumiem\n"); - return; - } + } + else{ + printf("Nerozumiem\n"); + return; + } } void print_tree(struct tree* tree,int offset){ @@ -125,10 +127,11 @@ int count_all(struct tree* node){ int main(){ struct tree* tree = NULL; - printf("Expert z bufetu to vie.\n"); + tree = read_tree(); int count = count_leaves(tree); - + + printf("Expert z bufetu to vie.\n"); printf("Pozna %d druhov ovocia a zeleniny.\n", count); printf("Odpovedajte 'a' pre prvu moznost alebo 'n' pre druhu moznost.\n");