Fhsdfjh
This commit is contained in:
parent
f6ab3ecefd
commit
f653b9ee4c
@ -22,7 +22,16 @@ void destroy_tree(struct tree* tree){
|
||||
}
|
||||
free(tree);
|
||||
}
|
||||
bool find_the_incorrect(struct tree* tree){
|
||||
if(tree == NULL){
|
||||
return false;
|
||||
}
|
||||
|
||||
if(strcspn( tree->value, "*") != strlen(tree->value) || strcspn(tree->value, "?") != strlen(tree->value)){
|
||||
return true;}
|
||||
return find_the_incorrect(tree->right) || find_the_incorrect(tree->left);
|
||||
|
||||
}
|
||||
struct tree* read_tree(){
|
||||
char buffer[SIZE];
|
||||
memset(buffer,0,SIZE);
|
||||
@ -69,9 +78,11 @@ int count_leaves(struct tree* tree){
|
||||
|
||||
int main(void){
|
||||
bool whitespace = false;
|
||||
|
||||
struct tree* tree = read_tree();
|
||||
bool found = find_the_incorrect(tree);
|
||||
print_tree(tree, 0);
|
||||
char line[SIZE];
|
||||
char line2[SIZE];
|
||||
|
||||
int numOfLeaves = count_leaves(tree);
|
||||
char answer[SIZE];
|
||||
@ -82,8 +93,9 @@ int main(void){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
printf("Expert z bufetu to vie.\n");
|
||||
if(!tree || !whitespace){
|
||||
if(!tree || !whitespace || found){
|
||||
printf("Chybna databaza\n");
|
||||
return 0;
|
||||
}
|
||||
@ -124,4 +136,5 @@ int main(void){
|
||||
}
|
||||
}
|
||||
destroy_tree(tree);
|
||||
return 0;}
|
||||
return 0;}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user