-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain1.cpp
43 lines (42 loc) · 909 Bytes
/
main1.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 <iostream>
#include <cstdio>
#include "Node.h"
#include "build_tree.h"
#include "CG_debug.h"
#include "evaluation.h"
using namespace std;
int main()
{
int n, m, q;
string buffer;
map<string, Node*> my_map;
vector<Node*> all_nodes;
vector<double> set_answer_value;
cin >> n;
getchar();
for(int i = 0; i < n; i++)
{
getline(cin, buffer);
build_var(buffer, my_map, all_nodes);
}
cin >> m;
getchar();
for(int i = 0; i < m; i++)
{
getline(cin, buffer);
build_tree(buffer, my_map, all_nodes);
}
cin >> q;
getchar();
for(int i = 0; i < q; i++)
{
getline(cin, buffer);
double answer;
if(Compute(buffer, my_map, set_answer_value, answer))
{
printf("%.4lf\n", answer);
}
set_answer_value.push_back(answer);
}
free_nodes(all_nodes);
}