+ 2
Why is this code not getting the last word?
It's supposed to add each word in a string to a vector, but doesn't add the last word. Why? https://code.sololearn.com/cgGIhN5p0d55/?ref=app
2 Respuestas
+ 3
It’s because the last word is stored in current, so after line 19, add:
vect.push_back(current);
And it will work.
+ 2
Thanks Rowsej
I tried modifying the if statement to see if i was equal to input.end() but that just gave me a compilation error. Not sure why I didn't think of your solution, lol.