c++ - istream& getline (istream& is, string& str); could be used for data which has '\n'? -


istream& getline (istream& is, string& str); here str terminates after newline character. if want deal situation str cotents 2-3 lines alternative?

you give message tell user terminate input eg

std::cout<<"enter message (enter finish. terminate input)"<<endl; while (mess != "finish.") {    std::getline(std::cin, mess);    input_message += mess;  } 

hope helps more dynamic