I try to read words from text file and store words as strings.
I use getline(fin, *word, ' '). But when it met '\n' or other punctuation characters, it didn't cut strings. Therefore, I write a function to cut strings, and I get stuck here.
1 2 3 4 5 6 7 8 9 10 11 12 13
string word(string *str)
for(unsignedint i = 0; str[i] != '\0'; i++)
if(isspace(str[i]) || ispunct(str[i]))
//how do I cut strings into words when it ends with whitespace or tab or punctuation character?