Mega Code Archive

 
Categories / C++ / String
 

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; }