20
This commit is contained in:
		
							parent
							
								
									f18b8a71ea
								
							
						
					
					
						commit
						7a1cff14d3
					
				| @ -49,6 +49,13 @@ int count_products(Node *node) { | ||||
| 
 | ||||
| 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"); | ||||
| 
 | ||||
| @ -72,17 +79,11 @@ void run_expert_system(Node *node) { | ||||
|             printf("Koniec\n"); | ||||
|             return; | ||||
|         } | ||||
| 
 | ||||
|         // Если после перехода достигли листа, выводим ответ и завершаем
 | ||||
|         if (!node->yes && !node->no) { | ||||
|             printf("*%s\n", node->text); | ||||
|             printf("Koniec\n"); | ||||
|             return; | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| void free_tree(Node *node) { | ||||
|     if (node) { | ||||
|         free_tree(node->yes); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user