当前位置:网站首页 > 技术博客 > 正文

c++freopen怎么用



#include <stdio.h> #include <iostream> using namespace std; int main() { int a,b; freopen("in.txt","r",stdin); //输入重定向,输入数据将从in.txt文件中读取  freopen("out.txt","w",stdout); //输出重定向,输出数据将保存在out.txt文件中 while(cin>> a >> b) cout<< a+b <<endl; // 注意使用endl  fclose(stdin);//关闭文件  fclose(stdout);//关闭文件 return 0; }

  • 上一篇: sql 内联
  • 下一篇: autoconv
  • 版权声明


    相关文章:

  • sql 内联2025-05-17 10:30:03
  • impdp tables2025-05-17 10:30:03
  • cmd获取上一条命令执行结果2025-05-17 10:30:03
  • 将xml转为json2025-05-17 10:30:03
  • 指针数组和数组指针的表示2025-05-17 10:30:03
  • autoconv2025-05-17 10:30:03
  • snat和dnat的应用场景2025-05-17 10:30:03
  • redis缓存的使用2025-05-17 10:30:03
  • 看云卷云舒,听花开花落,任潮起潮落2025-05-17 10:30:03
  • webshell什么意思2025-05-17 10:30:03