-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
63 lines (56 loc) · 1.53 KB
/
main.cpp
File metadata and controls
63 lines (56 loc) · 1.53 KB
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
54
55
56
57
58
59
60
61
62
63
// sample main file, replace this with your own code
#include <filesystem>
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
int main() {
string configPath = "./config";
string itemConfigPath = configPath + "/item.txt";
// read item from config file
ifstream itemConfigFile(itemConfigPath);
for (string line; getline(itemConfigFile, line);) {
cout << line << endl;
// do something
}
// read recipes
for (const auto &entry :
filesystem::directory_iterator(configPath + "/recipe")) {
cout << entry.path() << endl;
// read from file and do something
}
// sample interaction
string command;
while (cin >> command) {
if (command == "EXPORT") {
string outputPath;
cin >> outputPath;
ofstream outputFile(outputPath);
// hardcode for first test case
outputFile << "21:10" << endl;
outputFile << "6:1" << endl;
for (int i = 2; i < 27; i++) {
outputFile << "0:0" << endl;
}
cout << "Exported" << endl;
} else if (command == "CRAFT") {
cout << "TODO" << endl;
} else if (command == "GIVE") {
string itemName;
int itemQty;
cin >> itemName >> itemQty;
cout << "TODO" << endl;
} else if (command == "MOVE") {
string slotSrc;
int slotQty;
string slotDest;
// need to handle multiple destinations
cin >> slotSrc >> slotQty >> slotDest;
cout << "TODO" << endl;
} else {
// todo
cout << "Invalid command" << endl;
}
}
return 0;
}