reverse words in a given string in c++ code example Example: Reverse string C++ reverse(str.begin(),str.end());