-
Notifications
You must be signed in to change notification settings - Fork 0
/
newLeetcodeComp.cpp
45 lines (37 loc) · 1004 Bytes
/
newLeetcodeComp.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
#include <iostream>
#include <filesystem>
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
namespace fs = std::filesystem;
int main()
{
int competitionNumber;
cout << "🏆\033[92m MAKE LEET_CODE COMP \033[0m🏆\n";
cout << "what is the competition number?\n";
cin >> competitionNumber;
if (competitionNumber)
{
string directory = to_string(competitionNumber);
fs::create_directories("./LeetCode/Competitions/" + directory);
ofstream file;
for (int i = 1; i <= 4; i++)
{
file.open("./LeetCode/Competitions/" + directory + "/" + "q" + to_string(i) + ".cpp");
file << "#include \"../../../stdc++.h\"\n";
file << "\n";
file << "using namespace std;\n";
file << "\n";
file << "int main() {\n";
file << " // Solution\n";
file << "}\n";
file.close();
}
cout << "created comp " + directory;
}
else
{
cout << "\nLooks like this is not a valid competition number.";
}
}