From f806441c6ea6f219c3a18f79946963704e953149 Mon Sep 17 00:00:00 2001 From: dc254kw Date: Fri, 29 Nov 2019 01:09:31 +0100 Subject: [PATCH] program.c --- program.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 program.c diff --git a/program.c b/program.c new file mode 100644 index 0000000..39a8dc8 --- /dev/null +++ b/program.c @@ -0,0 +1,55 @@ +#include +#include +#include +#include + +#define SIZE 1000 + + struct node { + char question[SIZE]; + struct node* left; + struct node* right; + }; + + //https://eli.thegreenplace.net/2009/11/23/visualizing-binary-trees-with-graphviz + + void print_tree(struct node* tree,int offset){ + for (int i = 0; i < offset; i++){ + printf(" "); + } + printf("%s",tree->question); + if (tree->left){ + print_tree(tree->left,offset +3); + print_tree(tree->right,offset +3); + } + } + + struct node* read_tree(){ + return NULL; + } + + void traverse(struct node* tree){ + } + + int count_fruit(struct node* tree){ + return 0; + } + + + void delete_tree(struct node* tree){ + if (tree != NULL){ + delete_tree(tree->left); + delete_tree(tree->right); + free(tree); + } + } + + int main(){ + printf("MUDrC to vie.\n"); + struct node* tree = read_tree(); + + printf("Pozna %d druhov ovocia a zeleniny.\n",count_fruit(tree)); + printf("Odpovedajte 'a' alebo 'n'\n"); + traverse(tree); + delete_tree(tree); + }