-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLauncher.cpp
40 lines (37 loc) · 926 Bytes
/
Launcher.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
#include "CommodityMarketSystem.h"
#include <vector>
#include <string>
#include <iostream>
using namespace std;
void runCMS();
// Main function
int main(int argc, char* argv[]) {
if (argc == 2 && strcmp(argv[1], "base") == 0) {
runCMS();
return 0;
}
if (argc == 3 && strcmp(argv[1], "ext1") == 0) {
cout << "EXTENSION 1 NOT IMPLEMENTED" << endl;
return 1;
}
if (argc == 3 && strcmp(argv[1], "ext2") == 0) {
cout << "EXTENSION 2 NOT IMPLEMENTED" << endl;
return 2;
}
cout << "INVALID PROGRAM CALL" << endl;
return 3;
}
/*
* Runs the CMS, asking for input until an exit command is detected.
* Input is case- and format-sensitive (see original assignment for details).
*/
void runCMS() {
CommodityMarketSystem cms;
string command = "";
while (true) {
cout << "> ";
getline(cin, command);
if (command.compare("QUIT") == 0) break;
cms.processInput(command);
}
}