From cba7e62977bb83b4ced95ebb8706039b4337b718 Mon Sep 17 00:00:00 2001 From: Yurii Yakovenko Date: Mon, 11 Nov 2024 22:03:00 +0000 Subject: [PATCH] Update cv7/program.c --- cv7/program.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/cv7/program.c b/cv7/program.c index ba9559a..50a6fff 100644 --- a/cv7/program.c +++ b/cv7/program.c @@ -4,15 +4,13 @@ #include #include - #define SIZE 200 struct tree { - + char value[SIZE]; - struct tree *left, *right; }; @@ -21,14 +19,11 @@ struct tree* read_tree() char buffer[SIZE]; memset(buffer,0,SIZE); char* r = fgets(buffer,SIZE,stdin); - + assert(r); struct tree* node = (struct tree*)calloc(1,sizeof(struct tree)); memcpy(node->value,buffer,SIZE); - - - - + node->left=NULL; node->right=NULL; @@ -47,7 +42,7 @@ void print_tree(struct tree* tree,int offset){ for (int i = 0; i < offset; i++){ printf("."); } - + if(tree) printf("%s",tree->value); if (tree->left){ @@ -71,9 +66,9 @@ int main(void) printf("Pozna 2 druhov ovocia a zeleniny.\n"); struct tree *p=tr; + printf("Odpovedajte 'a' pre prvu moznost alebo 'n' pre druhu moznost.\n"); do - { - printf("Odpovedajte 'a' pre prvu moznost alebo 'n' pre druhu moznost.\n"); + { printf("%s",p->value); if(p->value[0]=='*') break; @@ -87,10 +82,11 @@ int main(void) }while(1); }while(1); + + printf("Koniec\n"); + return 0; } - -