0
how to place words of row in alphabetical order? C++
May be there are any special functions ?
3 Answers
+ 2
Split the string/sentence into words by using space as delimiter, and then store the words into a vector of string.
Sort the vector.
Join the string vector using space.
#include <sstream>
Use std::stringstream to split and join string.
#include <algorithm>
Use std::sort to sort order in vector.
+ 1
Words of row?
Show me the code?
+ 1
I don't have a code. I don't understand how to do it. For example: "The weather is sunny today" I need to place words in alphabetical order. I have written var for string and alphabet