-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.cpp
More file actions
32 lines (25 loc) · 755 Bytes
/
Main.cpp
File metadata and controls
32 lines (25 loc) · 755 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
#include "GridGraph.h"
#include <iostream>
#include <cstdlib>
#include <fstream>
using std::cout;
using std::endl;
int main(int argc, char *argv[]) {
unsigned long height, width;
if (argc == 3)
height = width = strtoul(argv[2], nullptr, 10);
else if (argc == 4) {
height = strtoul(argv[2], nullptr, 10);
width = strtoul(argv[3], nullptr, 10);
} else {
cout << "USAGE:\n\t" << argv[0] << " filename height width" << endl;
return 1;
}
unordered_set<const Edge*> edges;
GridGraph graph(height, width);
graph.prims(edges);
std::ofstream file(argv[1], std::ofstream::binary);
graph.printWithEdges(file, edges);
file.close();
return 0;
}