getline()的困惑,请高手指点!
程序就是书中的如下:
程序代码:#include <iostream>
#include <string>
using namespace std;
int main( )
{
string s;
while(getline(cin,s))
cout<<s<<endl;
return 0;
}
运行后结果如下:
1111
222
1111
33333
222
4444
33333
结果为什么不是:
1111
1111
222
222
33333
33333
请高人指点!







