-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
43 lines (33 loc) · 812 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include"akinator.hpp"
#include"Akinator_Data/akinator_data.hpp"
#include"Scanf_Tree/Akinator_Parser.hpp"
#define DATA_FILE "akinator_data.txt"
int main()
{
FILE* f = fopen(DATA_FILE, "r");
Akinator_Parser pars(f);
Tree* tree = pars.Get_Tree();
fclose(f);
bool quite = false;
char answer[5];
while(!quite)
{
do
{
printf("\nНовая игра?:Yes/No\n");
if(!get_answer(answer))
printf("\nНекорректный ответ\n");
else
break;
}while(1);
if(answer[0]=='Y')
akinator(tree);
if(answer[0]=='N')
quite = true;
}
f = fopen(DATA_FILE, "w");
Tree_Save(tree, f);
fclose(f);
Tree_Destroy(tree);
return 0;
}