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

vector<string>SplitStr(string s, char c){
	vector<string>items;
	string sItem = "";
	string temp = s;
	int i = 0;

	//Append c to end of temp if not found.
	if (temp[temp.size()] != c){
		temp.append(",");
	}

	while (i < temp.length()){
		//Check if char is c
		if (temp[i] == c){
			//Push the string onto the vector
			items.push_back(sItem);
			//Clear sItem string
			sItem.clear();
		}
		if (temp[i] != c){
			//Skip seperator.
			sItem += temp[i];
		}
		i++;
	}

	return items;
	//Clear up
	items.clear();
}

int main(){
	vector<string>items;
	string s = "Hello,World,Happy,Days";
	//Split the items
	items = SplitStr(s, ',');

	for each (string s1 in items)
	{
		//Print out items in the vector.
		std::cout << s1 << std::endl;
	}

	system("pause");
	return 0;
}