#include <iostream>
#include <sstream>
using namespace std;
int main()
{
string s = "1 2 3";
istringstream str(s);
while (str >> s) {
cout << s << endl;
}
return 0;
}
相关文章
- 04-17C++以空格为分隔符分隔string类型
2022-04-17 01:34:25
#include <iostream>
#include <sstream>
using namespace std;
int main()
{
string s = "1 2 3";
istringstream str(s);
while (str >> s) {
cout << s << endl;
}
return 0;
}