-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDriver.cpp
More file actions
33 lines (30 loc) · 984 Bytes
/
Driver.cpp
File metadata and controls
33 lines (30 loc) · 984 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
#include "Calculator.h";
#include "Stack.h";
#include "Array.h";
#include "Flyweight_Expr_Command_Factory.h";
//#include <bits/stdc++.h>;
#include <iostream>;
int main(int argc, char * argv []){
//** Calculator is not yet fully functional **
//Only the expression is being outputted rather than the result
//
Calculator * calc = new Calculator();
char input[50];
std::string command = "";
// COMMENT Your program should loop until QUIT is entered.
// RESPONSE This requirement is satisfied with the comparison of the command string
while(command.compare("QUIT") != 0){ //input[0] != 'Q'
std::cout << "Please type in a mathematical expression." << std::endl;
std::cin.getline(input, 50);
std::string input_str(input);
command = input_str;
if(command.compare("QUIT") != 0){ //input[0] != 'Q'
std::string expression(input);
calc->set_expression(expression);
calc->run();
}else{
std::cout << "BYE?" << std::endl;
}
}
return 0;
}