-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexpression.h
53 lines (42 loc) · 1.36 KB
/
expression.h
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
50
51
52
53
#ifndef EXPRESSION_H
#define EXPRESSION_H
#include "polynomial.h"
#include <iostream>
#include <vector>
#include <string>
using namespace std;
class expression
{
public:
//constructor
expression();
//UI for the program
void run(int argc, char *argv[]);
//TESTING
void test();
private:
//VARIABLES
vector<polynomial> exps = vector<polynomial>(26, polynomial("0")); //TESTED, init vector
const string commandArr[6] = {"LET", "EVAL", "PRINT", "LOAD", "SAVE", "NEWTON"}; //TESTED, init array
//MAIN FUNCTIONS
void prompt(); //TESTED
void help();
string getCommand(istream& in); //TESTED
void execCommand(string command);
void let(char funcName, string exp);
void eval(char funcName, fraction value);
void print(char funcName);
void load(string& filename);
void save(string& filename);
void algebra(string algebraExp); //TESTED
void execute(string filename);
void recordToFile(string filename, string line);
void newton(char funcName, fraction initGuess);
//ADDITIONAL FUNCTIONS
string toUpper(string str); //TESTED
string delSpace(string str); //TESTED
int index(char funcName); //TESTED, return 0 for a, 1 for b, etc
void saveStringToFile(string filename, string line, bool append = false);
void askString(string prompt, string& theString);
};
#endif // EXPRESSION_H