-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
42 lines (35 loc) · 984 Bytes
/
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
#include <iostream>
#include <ctime>
#include "Parser.hh"
#include "Comparator.hh"
int main(int ac, char** av)
{
// checking args
if (ac != 3)
{
std::cerr << "Usage: " << av[0] << " <file1> <file2>" << std::endl;
std::cerr << "<file1>: list of hashes" << std::endl;
std::cerr << "<file2>: list of words" << std::endl;
return -1;
}
// getting datas
Parser parser;
std::string file1 = av[1], file2 = av[2];
std::vector<std::string>& hashes = parser.GetLines(file1);
std::vector<std::string>& words = parser.GetLines(file2);
// get matches with time
Comparator comparator;
clock_t begin, end;
begin = clock();
comparator.ShowMatches(hashes, words);
end = clock();
double elapsed = double(end - begin) / CLOCKS_PER_SEC;
std::cout.precision(5);
std::cout << "time elapsed: " << elapsed << " second(s)" << std::endl;
// cleaning
hashes.clear();
delete &hashes;
words.clear();
delete &words;
return 0;
}