c++输入输出重定向

#define ACM //也可以放在编译器里 
#include<iostream>
#include<cstdio>
using namespace std;


int main(void) {
#ifdef ACM // 
	freopen("in.txt","r",stdin);//重定向输入流//in.txt 建在程序所在的文件夹里 
	freopen("out.txt","w",stdout);//重定向输出 
#endif
	int a,b;
	cin>>a>>b;
	cout<<a<<" "<<b<<endl;
	return 0;
}

猜你喜欢

转载自blog.csdn.net/nucleare/article/details/80055218