-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
43 lines (32 loc) · 920 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 "cmdparams.h"
#include <typeinfo>
#include <vector>
#include <fstream>
#include "generator.h"
int main(int argc, char* argv[])
{
CmdParams params(argc, argv);
if (params.isValid())
{
std::string fileName = params.getOutputFileName();
if(fileName.substr(fileName.size()-4, 4) != ".csv")
{
fileName += ".csv";
}
std::ofstream file(fileName);
if(!file)
{
std::cerr << "\nОшибка: невозможно создать файл по указанному пути \"" << fileName << "\"\n\n";
return 0;
}
Generator gen(params.getNumColumns(), params.getMaxLengthValue());
file << gen.getHeader();
for (int i = 0; i < params.getNumRows(); i++)
{
file << gen.generateRow();
}
file.close();
}
return 0;
}