#include <stdio.h>
#include <iostream>
int main()
{
int a,b;
freopen("D:\\in.txt","r",stdin); //输入重定向,输入数据将从D盘根目录下的in.txt文件中读取
freopen("D:\\out.txt","w",stdout); //输出重定向,输出数据将保存在D盘根目录下的out.txt文件中
while(cin>>a>>b)
cout<<a+b<<endl; // 注意使用endl
fclose(stdin);//关闭重定向输入
fclose(stdout);//关闭重定向输出
return 0;
}
【freopen】
猜你喜欢
转载自blog.csdn.net/qq_41037114/article/details/83050028
今日推荐
周排行