参考:https://blog.csdn.net/qq_33624592/article/details/64121942
原字符串:str1 = “qwe bbb 333”
输出结果:str[0] = “qwe” , str[1] = “bbb” , str[2] = “333”
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main()
{
string str1 = "qwe bbb 333";
string str[3];
istringstream is(str1);
is>>str[0]>>str[1]>>str[2];
cout<<str[0]<<","<<str[1]<<","<<str[2]<<endl;
return 0;
}