C++ 按行读取文件函数
函数:
#include<bits/stdc++.h>
using namespace std;
int main()
{
double x,y;
freopen("input.txt","r",stdin);//读取了一个名字为input的txt文件 并且进入输入流
freopen("output.txt","w",stdout);//打开一个名字为output的txt文件 读取输出流
while(cin>>x>>y) //cin按行读取 一次读取一行,知道末尾
{
cout<<x<<' '<<y<<endl;//按行读入 写入output文件中
}
return 0;
}