From 67de6c862969f459475e2fd79683256127b99fa8 Mon Sep 17 00:00:00 2001 From: Yurii Yakovenko Date: Mon, 11 Nov 2024 21:59:46 +0000 Subject: [PATCH] Update cv7/program.c --- cv7/program.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/cv7/program.c b/cv7/program.c index 2cb365c..ba9559a 100644 --- a/cv7/program.c +++ b/cv7/program.c @@ -4,13 +4,14 @@ #include #include + #define SIZE 200 struct tree { - + char value[SIZE]; - + struct tree *left, *right; }; @@ -24,18 +25,18 @@ struct tree* read_tree() assert(r); struct tree* node = (struct tree*)calloc(1,sizeof(struct tree)); memcpy(node->value,buffer,SIZE); + + + - - - node->left=NULL; node->right=NULL; if(node->value[0]!='*') { - + node->left=read_tree(node->left); - + node->right=read_tree(node->right); } return node; @@ -46,7 +47,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){ @@ -72,10 +73,10 @@ int main(void) struct tree *p=tr; do { + printf("Odpovedajte 'a' pre prvu moznost alebo 'n' pre druhu moznost.\n"); printf("%s",p->value); if(p->value[0]=='*') - break; - printf("Odpovedajte 'a' pre prvu moznost alebo 'n' pre druhu moznost.\n"); + break; do { t=fgetc(stdin); @@ -86,12 +87,10 @@ int main(void) }while(1); }while(1); - - printf("Koniec\n"); - - return 0; } + +