跳到正文

休闲·娱乐

造数据机

liujiayao约 4 分钟
原文
文章信息与版本

文章信息

发布
2025年7月24日
收录
2025年12月12日
更新
2026年11月18日
篇幅
约 4 分钟

版本

  1. v1当前

先上代码

C++
#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。

书写格式:

C++
#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输出输出内容。

原文