Update cv7/program.c

This commit is contained in:
Yurii Yakovenko 2024-11-11 22:51:03 +00:00
parent dbb38d9bdf
commit 2d1862f3ca

View File

@ -54,6 +54,22 @@ void print_tree(struct tree* tree,int offset){
}
}
int kkk(struct tree* tree, int x)
{
if (!tree)
{
return x;
}
x += (tree->value[0] == '*');
x = kkk(tree->left, x);
x = kkk(tree->right, x);
return x;
}
void destroy_tree(struct tree* tree){
if(tree==NULL) return;
@ -68,10 +84,13 @@ int main(void)
struct tree *tr;
tr=read_tree();
int kk;
char t;
kk=kkk(tr,0);
printf("Expert z bufetu to vie.\n");
printf("Pozna 2 druhov ovocia a zeleniny.\n");
printf("Pozna %d druhov ovocia a zeleniny.\n", kk);
struct tree *p=tr;
printf("Odpovedajte 'a' pre prvu moznost alebo 'n' pre druhu moznost.\n");
@ -115,4 +134,3 @@ int main(void)
}