This commit is contained in:
Anton Dolozin 2025-11-09 21:25:11 +01:00
parent a480aa16fe
commit 75cc8ff554

View File

@ -82,13 +82,9 @@ int count_non_leaves(struct tree* tree){
if(tree == NULL || ( tree->left== NULL && tree->right ==NULL)){
return 0;
}
return 1 + count_non_leaves(tree->left) +count_non_leaves(tree->right);
}
int main(void){
bool whitespace = false;
@ -96,6 +92,7 @@ int main(void){
char line[SIZE];
int numOfLeaves = count_leaves(tree);
int numOfNonLeaves = count_non_leaves(tree);
char answer[SIZE];
while (fgets(line, sizeof(line), stdin)) {
line[strcspn(line, "\n")] = '\0';
@ -103,12 +100,10 @@ int main(void){
whitespace = true;
break;
}
}
int res = count_non_leaves(tree);
int res2 = numOfLeaves - res;
};
bool found = find_the_incorrect(tree);
printf("Expert z bufetu to vie.\n");
if(!tree || !whitespace || found || res2 < 1){
if(!tree || !whitespace || found || strcmp(tree->value, "Je to ovocie alebo zelenina") != 0){
printf("Chybna databaza\n");
return 0;
}