This commit is contained in:
Deinerovych 2024-11-08 13:43:23 +01:00
parent d767e19e40
commit 3f2d17ecd7

View File

@ -55,13 +55,16 @@ void run_expert_system(Node *node) {
while (node) {
if (!node->yes && !node->no) { // Достигнут конечный узел
printf("*%s\n", node->text);
printf("Koniec\n");
return;
}
printf("Odpovedajte 'a' pre prvu moznost alebo 'n' pre druhu moznost.\n");
printf("%s\n", node->text);
char answer;
if (scanf(" %c", &answer) != 1) {
printf("Koniec\n");
return;
}
@ -70,6 +73,7 @@ void run_expert_system(Node *node) {
} else if (answer == 'n') {
node = node->no;
} else {
printf("Koniec\n");
return;
}
}
@ -105,6 +109,7 @@ int main() {
return 1;
}
printf("Expert z bufetu to vie.\n");
int product_count = count_products(root);
printf("Pozna %d druhov ovocia a zeleniny.\n", product_count);