vector<string> CategoryWithoutHashTags;
string tester = "#hello junk #world something #cool";
char *pch;
char *str;
str = new char [tester.size()+1];
strcpy(str, tester.c_str());
pch = strtok(str,"#");
while(pch!=NULL)
{
CategoryWithoutHashTags.push_back(pch);
pch=strtok(NULL,"#");
}
cout<<CategoryWithoutHashTags[0]<<endl;
我想编写一个程序,该程序涉及将所有哈希标签单词存储在字符串向量中。上面的程序在第一个索引中存储“hello junk”而不是“hello”。我可以对程序进行哪些更改以使其这样做?