string text;getline(cin,text,'#');连续输入,直到遇到‘#’号时停止,该终止符可以更换为其他符号!
楼主不妨试试string str;cin>>noskipws>>str;