-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSandbox.h
More file actions
executable file
·49 lines (43 loc) · 922 Bytes
/
Sandbox.h
File metadata and controls
executable file
·49 lines (43 loc) · 922 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
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
Eugene Li
CS9163
*/
#ifndef SANDBOX_H
#define SANDBOX_H
#include <stdlib.h>
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include <map>
#include <vector>
#include <math.h>
using namespace std;
class Sandbox
{
public:
Sandbox();
void prompt();
void openAndRun(string prog);
void processInstruction(string instr);
string getMode();
bool isClosed();
bool hasError();
void setErrorMessage(string message);
string getErrorMessage();
void displayErrorMessage();
void clearErrors();
private:
static const int MAX_MEMORY = 512;
string mode;
int jump;
bool error;
bool exit;
string errorMessage;
map<string, double> memory;
vector<string> instructions;
void saveToMemory(string var, double value);
bool validVariable(string str);
bool containsAlpha(string str);
};
#endif SANDBOX_H