如何等待用户按回车后显示下一行?
编一个程序,一次显示文件的一行,然后,等待用户按回车后显示下一行??
我写的
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
int main()
{
ifstream in("1.txt");
if(!in)
{
cerr<< "can not open \n";
exit(1);
}
string s;
while(getline(in,s))
cout<<s<<"\n";
cout<<endl;
return 0;
}
需要怎么添加啊?