-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGen.cpp
More file actions
57 lines (39 loc) · 1.23 KB
/
Gen.cpp
File metadata and controls
57 lines (39 loc) · 1.23 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
//
// Created by Wasiollo on 07.11.17.
//
#include <iostream>
#include "Generator.h"
#include "cxxopts.hpp"
#include <ctime>
int main(int argc, char **argv) {
int n, d;
n = 0;
d = time(NULL);
try {
cxxopts::Options options(argv[0], " - command line options");
options
.positional_help("[optional args]")
.show_positional_help();
options.add_options("Program")
("n, number", "Get number of tasks", cxxopts::value<int>())
("d, seed", "Get seed for generator", cxxopts::value<int>())
("h, help", "Print help");
auto result = options.parse(argc, argv);
if (result.count("help")) {
std::cout << options.help({"", "Program"}) << std::endl;
exit(0);
}
if (result.count("n")) {
n = result["n"].as<int>();
}
if (result.count("d")) {
d = result["d"].as<int>();
}
} catch (const cxxopts::OptionException &e) {
std::cout << "error parsing options: " << e.what() << std::endl;
exit(1);
}
std::string generatedData = Generator::generate(n, d);
std::cout << generatedData << std::endl;
return 0;
}