Reversing an STL String : string reverse « String « C++






Reversing an STL String

  
#include <string>
#include <iostream>
#include <algorithm>

using namespace std;
int main ()
{
   string strSample ("Hello String! ");
   cout << strSample << endl;

   reverse (strSample.begin (), strSample.end ());
   cout << strSample;

   return 0;
}
  
    
  








Related examples in the same category

1.Reverse the order of all characters inside the string
2.Reversing a String and Finding its Length
3.Print characters read from keyboard in reverse order
4.Reverse a string in place.
5.Use a reverse iterator to display the string in reverse