求助大佬!!!
  • 板块灌水区
  • 楼主farmer_snack
  • 当前回复6
  • 已保存回复6
  • 发布时间2024/2/25 20:05
  • 上次更新2024/2/26 08:54:15
查看原帖
求助大佬!!!
581445
farmer_snack楼主2024/2/25 20:05
#include<bits/stdc++.h>
using namespace std;
int x;
string s;
int main()
{
	srand(time(0));
	fstream file;
	file.open("submit.txt",ios::in|ios::out);
	if(!file.is_open())
	{
		cout<<"Worring ! We can't open the file !";
		exit(1);
	}
	int flag=0;
	while(!file.eof())
	{
		file >> s;
		getline (file,s);
                cout<<s;
		if(flag==1)
		{
			flag++;
		}
		if(s.find("main")!=-1)
		{
			flag=1;
		} 
		if(file.is_open())
		{
			file << s;
		}
		else
		{
			cout<<"Worring ! We can't open the file !";
			exit(1);
		}
		if(flag==2)
		{
			file << "freopen(\"in.txt\",\"r\",stdin);"; 
			file << "freopen(\"out.txt\",\"w\",stdout);"; 
		}
	}
	file.close();
}

有没有大佬帮帮我,无论submit.txt怎么改,都不会输出

2024/2/25 20:05
加载中...