freopen重定向输入

#include <bits\stdc++.h>
using namespace  std;
int main()
{
    freopen("C:\\Users\\dcf\\Desktop\\txt.txt","r",stdin);
    int n,mx=0;
    while(cin>>n)
    {
        if(n>mx)
            mx=n;
    }
    cout<<mx<<endl;
    return 0;
}

freopen 可代替大量的数据输入

posted @ 2017-04-10 15:53  锅里煮水  阅读(130)  评论(0编辑  收藏  举报