-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
executable file
·38 lines (28 loc) · 810 Bytes
/
main.cpp
File metadata and controls
executable file
·38 lines (28 loc) · 810 Bytes
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
#include "postfix_notation.hpp"
using namespace std::chrono;
int main()
{
std::vector<std::string> vs_infix;
std::ifstream fl("equation.v");
std::string line;
while (std::getline(fl, line))
vs_infix.push_back(line);
int n(1000000);
for (auto &e : vs_infix)
{
mp::Postfix pf(e);
PRINT(pf.to_infix());
// Start clock
steady_clock::time_point begin = steady_clock::now();
for(int i=0;i<n;i++)
pf.evaluate_rpn();
// End clock
steady_clock::time_point end = steady_clock::now();
double runTimeInSecond = duration_cast<milliseconds>(end - begin).count() / 1000.;
PRINT( std::endl << "runtime (s): " << runTimeInSecond );
PRINT(" ");
}
for (auto &v : mp::VariableInstance::stored)
PRINT("VARIABLE: " << v->name << ",\tcount: " << v.use_count() );
return 1;
}