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