-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
50 lines (39 loc) · 1.13 KB
/
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
44
45
46
47
48
49
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include "Calc.h"
using namespace std;
int main2() //testing
{
CMatrix mtrx{"[1 2 3; 4 5 6]"}, mtrx2{5}, mtrx3{"[1,2,3;4,5,6]"};
CVariable v1{"ans", mtrx}, v2{"a",5.0}, v3{"b",4.0};
cout << v1.Value() << endl;
cout << v2.Value().IsSingle() << endl;
v1 = v2.Value() + v3.Value();
cout << v1.Value() << endl;
}
int main()
{
// print welcome message
cout << endl;
cout << "\tWelcome to the EECS 211 MP#5: A Programmable Calculator" << endl;
cout << "\t\tName: Alexander Martin"<< endl; // your name here
cout << "\t\t Copyright, 2014 " << endl << endl;
string testfilename = "TestCase.txt";
ifstream testfile(testfilename);
Calc newCalc;
//Create a new calculator from the right source.
if (!testfile.is_open())
{
cout << "Error reading test file \"" << testfilename << '"' << endl;
cout << "Reading from cin" << endl << endl;
}
else
{
cout << "Reading from test file \"" << testfilename << '"' << endl << endl;
newCalc.setSource(testfile);
}
newCalc.run();
return 0;
}