請參閱下面的評論。系統(「暫停」)不能與freopen一起使用
int main(){
//freopen("input.txt","r",stdin);//if I uncomment this line the console will appear and disappear immediately
int x;
cin>>x;
cout<<x<<endl;
system("pause");
return 0;
}
如何使它工作?
更重要的是,*你爲什麼要使用'系統( 「暫停」)'*? –
我使用這個功能,因爲我想看到程序輸出。 – SevenDays
閱讀此:http://www.gidnetwork.com/b-61.html和/或此:http://stackoverflow.com/questions/1107705/systempause-why-is-it-wrong –