输入1,2,3,4....输出1 2 3 4并且输出结果要换行(STL Find_first_of)

#include <iostream>
#include <string>
#include <vector>
using namespace std;

////////////////////////////
void main()
{
	vector<string> vStr;
	string str;
	cin>>str;
	str = str + ",";
	while(str.size() != 0)
	{
		vStr.push_back(str.substr(0,str.find_first_of(',',0)));
		str.erase(0,str.find_first_of(',',0)+1);
	}
	for(int i = 0;i < vStr.size();i++)
		cout<<vStr[i]<<endl;
}
/*
输入:12,4,5,3,4,....,100 (任意数量)
然后输出
12
4
5
3
4
...
100

测试用例:
1,4,6,7,8,23,54,678,90,12
1
4
6
7
8
23
54
678
90
12
*/	

你可能感兴趣的:(输入1,2,3,4....输出1 2 3 4并且输出结果要换行(STL Find_first_of))