-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathmain.cpp
56 lines (45 loc) · 1.73 KB
/
main.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
45
46
47
48
49
50
51
52
#include <iostream> // for cout, cin
#include <fstream> // for ifstream
#include <sstream> // for stringstream
#include <filesystem> // making inputting files easier
#include <unordered_set> // containers for the wikiscraper
#include <vector>
#include <queue>
#include <unordered_map>
#include "wikiscraper.h" // wikiscraper methods
using std::cout; using std::endl;
using std::ifstream; using std::stringstream;
using std::string; using std::vector;
using std::priority_queue; using std::unordered_map;
using std::unordered_set; using std::cin;
int main() {
// a quick working directory fix to allow for easier filename inputs
auto path = std::filesystem::current_path() / "res/";
std::filesystem::current_path(path);
std::string filenames = "Available input files: ";
for (const auto& entry : std::filesystem::directory_iterator(path)) {
std::string filename = entry.path().string();
filename = filename.substr(filename.rfind("/") + 1);
filenames += filename + ", ";
}
// omit last ", ".
cout << filenames.substr(0, filenames.size() - 2) << "." << endl;
/* Container to store the found ladders in */
vector<vector<string>> outputLadders;
cout << "Enter a file name: ";
string filename;
getline(cin, filename);
/*
TODO: Create a filestream from the filename.
For each pair {start_page, end_page} in the input file,
retrieve the result of findWikiLadder(start_page, end_page)
and append that vector to outputLadders.
*/
// Write code here
/*
* Print out all ladders in outputLadders.
* We've already implemented this for you!
*/
// Write code here
return 0;
}