-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
29 lines (25 loc) · 809 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
#include "mainwindow.h"
#include <QApplication>
#include <memory>
#include <iostream>
#include "complexnumber.h"
#include "operator.h"
int main(int argc, char* argv[]) {
Stack<ComplexNumber> operands;
Stack<std::shared_ptr<Evaluatable> > stack;
stack.push(std::make_shared<ComplexNumber>(25));
stack.push(std::make_shared<ComplexNumber>(4));
stack.push(std::make_shared<Operator>('*'));
stack.push(std::make_shared<ComplexNumber>(10));
stack.push(std::make_shared<Operator>('+'));
auto evaluationStack = stack.reversed();
while (!evaluationStack.empty()) {
evaluationStack.pop()->evaluate(operands);
}
std::cout << operands.pop() << std::endl;
//QApplication a(argc, argv);
//MainWindow w;
//w.show();
//return a.exec();
return 0;
}