-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathshell.cpp
44 lines (39 loc) · 1.01 KB
/
shell.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
#include <iostream>
#include <vector>
#include <sstream>
#include <memory>
using namespace std;
template<class CONTAINER, class FUNC>
string map_join(const CONTAINER& c, FUNC f, string sep) {
stringstream ss;
for (auto it = c.begin(); it != c.end(); it++) {
ss << (it == c.begin() ? "" : sep);
ss << f(*it);
}
return ss.str();
}
int main() {
while (true) {
string line, cmd;
getline(cin, line);
cout << "$" << line << endl;
stringstream ss(line);
ss >> cmd;
if (cmd == "end") {
break;
} else if (cmd == "show") {
} else if (cmd == "init") {
// int qtd;
// ss >> qtd;
} else if (cmd == "reserve") {
// string id, phone;
// int index;
// ss >> id >> phone >> index;
} else if (cmd == "cancel") {
// string id;
// ss >> id;
} else {
cout << "fail: comando invalido" << endl;
}
}
}