Update 'cv8/program.c'
This commit is contained in:
parent
fe588c4846
commit
c48089f312
@ -19,7 +19,7 @@ void print_tree(struct tree* tree, int offset);
|
||||
void print_dot(struct tree* node);
|
||||
int count_leaves(struct tree* node);
|
||||
int count_no_leaves(struct tree* node);
|
||||
void knowledge_system(struct tree* node);
|
||||
void knowledge_system(struct tree* node, int* flag);
|
||||
|
||||
struct tree* read_tree(int* counter) {
|
||||
char buffer[SIZE];
|
||||
@ -91,7 +91,7 @@ int count_no_leaves(struct tree* node) {
|
||||
return 1 + count_no_leaves(node->left) + count_no_leaves(node->right);
|
||||
}
|
||||
|
||||
void knowledge_system(struct tree* node) {
|
||||
void knowledge_system(struct tree* node, int* flag) {
|
||||
if (node == NULL) {
|
||||
return;
|
||||
}
|
||||
@ -120,9 +120,9 @@ void knowledge_system(struct tree* node) {
|
||||
} while (response != 'a' && response != 'n');
|
||||
|
||||
if (response == 'a') {
|
||||
knowledge_system(node->left);
|
||||
knowledge_system(node->left, flag);
|
||||
} else {
|
||||
knowledge_system(node->right);
|
||||
knowledge_system(node->right, flag);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user