造数据机

· · 休闲·娱乐

先上代码

#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
string s,name;
int js=0,i,num;
int main()
{
    freopen("test.cpp","r",stdin);
    freopen("create.cpp","w",stdout);
    cout<<"#include<cstdlib>\n#include<stdio.h>\n#include<cstring>\n#include<bits/stdc++.h>\n#include<string.h>\nusing namespace std;\nstring djskdjiw=\"";
    while(getline(cin,s))
    {
        ++js;
        if(js==3)
        {
            i=13;
            name="";
            while(s[i]!='"')
            {
                name+=s[i];
                i++;
            }
            cout<<name<<"(\",wdkwokd=\").in\",jwmdow,wjdjwsjd=\").out\";\nint wdfdkkd=1,num=";
        }
        else if(js==4)
        {
            i=8;
            while('0'<=s[i]&&s[i]<='9')
            {
                num*=10;
                num+=int(s[i]-'0');
                i++;
            }
            cout<<num<<";\nstring zh(int x)\n{\n    string s=\"\";\n    int y[1001]={},n=0;\n   while(x)\n  {\n     y[++n]=x%10;\n      x/=10;\n    }\n for(int i=n;i>=1;i--)\n {\n     s+=char(y[i]+\'0\');\n  }\n return s;\n}\nint main()\n{\n   srand(0);\n while(wdfdkkd<=num)\n   {\n";
        }
        else if(js==6)break;
    }
    while(getline(cin,s))
    {
        if(s=="//in")break;
        cout<<" "<<s<<"\n";
    }
    cout<<"     jwmdow=djskdjiw+zh(wdfdkkd)+wdkwokd;\n      freopen(jwmdow.c_str(),\"w\",stdout);\n";
    while(getline(cin,s))
    {
        if(s=="//out")break;
        cout<<" "<<s<<"\n";
    }
    cout<<"     fclose(stdout);\n       jwmdow=djskdjiw+zh(wdfdkkd)+wjdjwsjd;\n     freopen(jwmdow.c_str(),\"w\",stdout);\n";
    while(getline(cin,s))
    {
        if(s=="//end")break;
        cout<<" "<<s<<"\n";
    }
    cout<<"     fclose(stdout);\n       wdfdkkd++;\n    }\n return 0;\n}";
    fclose(stdout);
    system("g++ -std=c++11 -O0 -Werror create.cpp -o create.exe");
    system("start create.exe");
    return 0;
}

使用说明

在你存放该程序(↑)的文件夹新建程序,命名为test.cpp。

书写格式:

#include<bits/stdc++.h>
using namespace std;
string name="test";
int num=20;
int main()
{
    int a,b;
    a=rand()%2147483647;
    b=rand()%2147483647;
//in
    cout<<a<<b;
//out
    cout<<a+b;
//end
    return 0;
}

格式问题:

1.name为数据文件名,num为数据组数,可按需求更改。

2.切勿在main函数外书写无关内容!不能更改第1-6行的内容(name和num的值除外)!

3.示例代码内的注释必须加,对应行不能有其他内容!

4.main函数内{到//in为预处理内容(如:定义,随机输入(不用写srand(0)),计算),//in到//out输出输入内容,//out到//end输出输出内容。