string::empty
bool empty() const noexcept;
注:判断string对象是否为空,为空返回true
#include <iostream>
#include <string>
using namespace std;
int main()
{
string line;
string content;
cout << "enter line\n";
do{
getline(cin, line);
content += line + '\n';
}while(!line.empty());
cout << content;
}