-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
36 lines (30 loc) · 1007 Bytes
/
main.cpp
File metadata and controls
36 lines (30 loc) · 1007 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
#include <iostream>
#include "base.hpp"
#include "add.hpp"
#include "op.hpp"
#include "sub.hpp"
#include "mult.hpp"
#include "div.hpp"
#include "pow.hpp"
#include "rand.hpp"
using namespace std;
int main() {
// This is a very basic main, and being able to correctly execute this main
// does not constitute a completed lab. Make sure you write unit tests for
// all the classes that you create (and can be instantiated) in this lab
Base* three = new Op(3);
Base* seven = new Op(7);
Base* four = new Op(4);
Base* two = new Op(2);
Base* mult = new Mult(seven, four);
Base* add = new Add(three, mult);
Base* minus = new Sub(add, two);
std::cout << minus->stringify() << " = " << minus->evaluate() << std::endl;
Base* rand = new Rand();
Base* zero = new Op(0);
Base* one = new Op(1);
Base* power = new Pow(rand, zero);
Base* add1 = new Add(one, power);
cout << add1->stringify() << " = " << add1->evaluate() << endl;
return 0;
}