让我说我有
string sentence{"Hello how are you."}
Run Code Online (Sandbox Code Playgroud)
而且我希望字符串句子没有"Hello"而"你好吗".我该怎么做呢
我尝试过这样的事情:
stringstream ss(sentence);
ss>> string junkWord;//to get rid of first word
Run Code Online (Sandbox Code Playgroud)
但是当我这样做时:
cout<<sentence;//still prints out "Hello how are you"
Run Code Online (Sandbox Code Playgroud)
很明显,stringstream它不会改变实际的字符串.我也尝试过使用,strtok但效果不佳string.