/*********************************************************************************
Copyright(C),Your Company
Author: KimChow
Date: 2021-04-16
Description:C++ 字符串分割
Others:
**********************************************************************************/
#include
#include
#include
using namespace std;
int main()
{
string data = "12,2,3,4,5,6";
stringstream sstr(data);
string item;
vector scores(6);
int i = 0;
stringstream sStrTemp;
cout << data << endl;
while (getline(sstr, item, ','))
{
sStrTemp << item;
sStrTemp >> scores[i];
sStrTemp.clear();
i++;
}
cout << "";
return 0;
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)