之前看到有大哥写出一个88W行C++代码
就是下面这张图
这88W行代码肯定是脚本生成的,不然不得敲死?
但目前并没有人发这个代码生成,那么我就做第一个吃螃蟹的人吧(bushi)
#include<iostream>
#include<fstream>
#include<cstring>
using namespace std;
int main()
{
const char* path = "C:\\Users\\88W行代码.cpp"; //生成的C++代码文件路径
cout << "代码生成中······" << endl;
ofstream f;
f.open(path);
f << "#include<iostream>" << endl;
f << "using namespace std;" << endl;
f << "int main() {" << endl;
f << "\tcout << \"请给出一个不多于5位的正整数:\";" << endl;
f << "\tint x;" << endl;
f << "\tcin >> x;" << endl;
f << "\tswitch (x) {" << endl;
for (int i = 1; i < 100000; i++)
{
if (i < 10) {
f << "\tcase " << i << ":" << endl;
f << "\t\tcout << \"是1位数\" << endl;" << endl;
f << "\t\tcout << \"个位数是" << i % 10 << "\" << endl;" << endl;
f << "\t\tcout << \"倒过来是:" << i << "\" << endl;" << endl;
f << "\t\tbreak;"