c++ input and output redirection

#define ACM // can also be placed in the compiler
#include<iostream>
#include<cstdio>
using namespace std;


int main(void) {
#ifdef ACM //
	freopen("in.txt","r",stdin);//Redirect input stream//in.txt is built in the folder where the program is located
	freopen("out.txt","w",stdout);//Redirect output
#endif
	int a,b;
	cin>>a>>b;
	cout<<a<<" "<<b<<endl;
	return 0;
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324824914&siteId=291194637