Question: In c++, write a function (named sort_words) that takes an array of strings and returns a vector of sorted strings. sort_words only takes one argument,
In c++, write a function (named "sort_words") that takes an array of strings and returns a vector of sorted strings. sort_words only takes one argument, the array of strings.
Example usage:
#includeusing std::string; #include using std::vector; string words[] = {"cat", "ant", "dog"}; vector result = sort_words(words); vector expected = {"ant", "cat", "dog"}; expected == result; // Should be true
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
