refresh
This commit is contained in:
parent
13cda5f925
commit
292d614a73
@ -17,9 +17,8 @@ static TreeNode* read_tree_node() {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buffer[0] == '\n' || buffer[0] == '\r') {
|
if (buffer[0] == '\n' || buffer[0] == '\r')
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
TreeNode *node = calloc(1, sizeof(TreeNode));
|
TreeNode *node = calloc(1, sizeof(TreeNode));
|
||||||
if (!node)
|
if (!node)
|
||||||
@ -47,10 +46,8 @@ static void free_tree(TreeNode *root) {
|
|||||||
|
|
||||||
static int count_leafs(TreeNode *root) {
|
static int count_leafs(TreeNode *root) {
|
||||||
if (!root) return 0;
|
if (!root) return 0;
|
||||||
|
|
||||||
if (!root->yes_branch && !root->no_branch)
|
if (!root->yes_branch && !root->no_branch)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return count_leafs(root->yes_branch) + count_leafs(root->no_branch);
|
return count_leafs(root->yes_branch) + count_leafs(root->no_branch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +80,7 @@ static void run_dialog(TreeNode *root) {
|
|||||||
|
|
||||||
char c;
|
char c;
|
||||||
if (scanf(" %c", &c) != 1) {
|
if (scanf(" %c", &c) != 1) {
|
||||||
printf("Koniec\n");
|
printf("Koniec vstupu\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,8 +94,7 @@ static void run_dialog(TreeNode *root) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
TreeNode *root = read_tree_node();
|
||||||
TreeNode *root = read_tree_node();
|
|
||||||
|
|
||||||
printf("Expert z bufetu to vie.\n");
|
printf("Expert z bufetu to vie.\n");
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user