hz3
This commit is contained in:
		
							parent
							
								
									89f91eaf1c
								
							
						
					
					
						commit
						118fa833c4
					
				| @ -52,10 +52,12 @@ int count_products(Node *node) { | ||||
| 
 | ||||
| // Запускает систему, задавая вопросы и ожидая ответы
 | ||||
| void run_expert_system(Node *node) { | ||||
|     int end_input = 0;  // Флаг, чтобы отметить "Koniec vstupu" только в нужных случаях
 | ||||
| 
 | ||||
|     while (node) { | ||||
|         if (!node->yes && !node->no) {  // Достигнут конечный узел
 | ||||
|             printf("*%s\n", node->text); | ||||
|             printf("Koniec vstupu\n"); | ||||
|             printf("Koniec\n"); | ||||
|             return; | ||||
|         } | ||||
| 
 | ||||
| @ -64,8 +66,8 @@ void run_expert_system(Node *node) { | ||||
| 
 | ||||
|         char answer; | ||||
|         if (scanf(" %c", &answer) != 1) { | ||||
|             printf("Koniec vstupu\n"); | ||||
|             return; | ||||
|             end_input = 1;  // Устанавливаем флаг для "Koniec vstupu"
 | ||||
|             break; | ||||
|         } | ||||
| 
 | ||||
|         if (answer == 'a') { | ||||
| @ -77,6 +79,10 @@ void run_expert_system(Node *node) { | ||||
|             return; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     if (end_input) { | ||||
|         printf("Koniec vstupu\n"); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| // Освобождает выделенную память для дерева
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user