I want to copy the words in the chars array to the vector string.I wrote the following code and it gives me errors that string,vector,words wasn't declared in this scope,and I declared the function in the header file can you help??
here is the code:
vector<string> split(char sentence[])
{
vector<string> ans(100);
int count=0;
for(unsigned int i=0;i<sentence.size();i++)
{
if(sentence[i]==' ')
count=count+1;
ans[count]=ans[count]+sentence[i];
}
return ans;
}