C++之文件輸入

#include <iostream>
#include <algorithm>
#define MAX 2*100001
//#define BUG
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
	freopen("in.txt","r",stdin); 
	freopen("out.txt","w",stdout);
	int n;
	int da[MAX];
	cin>>n;
	for(int i=0;i<n;i++) cin>>da[i];
	for(int i=0;i<n;i++) cout<<da[i]<<" ";
	
	fclose(stdin);
	fclose(stdout);
	return 0;
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章