-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0_igen.cpp
66 lines (66 loc) · 1.68 KB
/
0_igen.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
65
66
#include <bits/stdc++.h>
#include <windows.h>
#include <fstream>
using namespace std;
int main()
{
// cout << "从B2001到B多少\n\n";
// freopen("gen.txt", "r", stdin);
int i;
cin>>i;
// int endname=1;
// cin >> i;
// cout << endname << endl;
string fname = "B";
string header = "# ";
string header2 = " `Python3`和`C++`代码对比\n\n## C++ 代码\n\n```cpp\n\n";
string middle = "```cpp\n\n ***\n\n## Python 代码\n\n```py\n\n";
string end = "```py";
stringstream ss;
// ss.clear();
ss << i;
string str;
ss >> str;
cout<<i<<endl;
// cout<<str<<endl;
fname += str;
// cout<<fname<<endl;
// system("pause");
string mdname = fname;
mdname += ".md";
cout << mdname << endl;
header += fname;
header += header2;
// system("powershell");
freopen(mdname.c_str(), "w", stdout);
cout << header << endl;
// powershell -Command \"cat B2001.cpp\"
string cmd_cpp = "powershell -Command \"cat ";
cmd_cpp += fname;
cmd_cpp += ".cpp\"";
// cout<<cmd_cpp<<endl;
system(cmd_cpp.c_str());
cout << middle << endl;
string cmd_py = "powershell -Command \"cat ";
cmd_py += fname;
cmd_py += ".py\"";
// cout<<cmd_py<<endl;
system(cmd_py.c_str());
cout << end << endl;
fclose(stdout);
string nfname="B";
i++;
ss.clear();
ss << i;
// string str;
ss >> str;
nfname+=str;
string cppnf=nfname+".cpp";
string pynf=nfname+".py";
string gcpp="blank.bat>"+cppnf;
string gpy="blank.bat>"+pynf;
system(gcpp.data());
// system("taskkill /f /im winver.exe /t");
system(gpy.data());
// system("taskkill /f /im winver.exe /t");
}