编程语言
首页 > 编程语言> > C++以空格为分隔符分隔string类型

C++以空格为分隔符分隔string类型

作者:互联网

#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;
}

标签:std,main,string,istringstream,C++,str,分隔符,include
来源: https://blog.csdn.net/m0_46283220/article/details/115278142