cc++ 中有关freeopen介绍

xiaoxiao2025-05-29  39

 

 

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

转载地址

转载请注明原文地址: https://www.6miu.com/read-5030915.html

最新回复(0)