C++ 重定向

测试代码时经常需要重定向输入输出,下面是一个简单例子。

    freopen ("input.txt", "r", stdin);
    int n;
    cin>>n;
    cout<<"n is "<<n<<endl;

猜你喜欢

转载自www.cnblogs.com/yeran/p/10959633.html