-
Notifications
You must be signed in to change notification settings - Fork 0
/
Filejen.cpp
64 lines (59 loc) · 1.67 KB
/
Filejen.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
53
54
55
56
57
58
59
60
61
62
63
64
#include <iostream>
#include <string>
#include <fstream>
#include <chrono>
#include <unordered_map>
using namespace std;
using namespace std::chrono;
void lower(string s)
{
transform(s.begin(), s.end(), s.begin(), ::tolower);
}
void generateFile(string fileID, string preset)
{
printf("Generating... {filename=%s, presets=%s}\n", fileID.c_str(), preset.c_str());
ofstream Filejen(fileID);
Filejen << preset + "\n";
Filejen.close();
cout << "Filejenerated!\n";
}
int main()
{
cout << "Filejen C++ 2022 V2.0\n";
cout << "Fast input? (Y)\n";
string s = "";
getline(cin, s);
lower(s);
bool fInp = (s.compare("y") == 0);
if (fInp)
{
cout << "{filename.filetype, presets}\n";
string fileID = "";
string presets = "";
string inp = "";
getline(cin, inp);
string delimiter = ", ";
fileID = inp.substr(0, inp.find(delimiter));
presets = inp.substr(inp.find(delimiter) + delimiter.size(), inp.size());
generateFile(fileID, presets);
}
else
{
cout << "Enter filename:\n";
string filename = "";
getline(cin, filename);
cout << "Enter filetype:\n";
string filetype = "";
getline(cin, filetype);
lower(filetype);
cout << "Enter input presets:\n";
string presets = "";
getline(cin, presets);
generateFile(filename + "." + filetype, presets);
}
// auto start = high_resolution_clock::now();
// auto stop = high_resolution_clock::now();
// auto duration = duration_cast<microseconds>(stop - start);
// cout << "Program Duration: " << duration.count() << endl;
return 0;
}