64,685
社区成员
发帖
与我相关
我的任务
分享
string filename, temp;
cout << "input the file name:" << endl;
cin >> filename;
ifstream infile(filename);
getline(infile, temp);
cout << temp<<endl;//这里一次性把文本文件所有内容全输出了 为什么不是一行呢?
/*while (getline(infile,temp))
{
cout << temp; //这个循环输出的也是全部内容
}*/
cout << "hello world!" << endl;
system("pause");
return 0;