64,649
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ofstream out("readfile.file");
out << "the first line" << endl;
out << "the second line" << endl;
out.close();
ifstream in("readfile.file");
string str;
while(getline(in, str))
{
cout << str << endl;
}
return 0;
}