Reverses the order of the elements in the range [first,last).
Example
#include <algorithm> #include <iostream> using namespace std; int main() { string str("Hello"); cout<<"Original String : "<<str<<endl; reverse(str.begin(), str.end()); cout<<"Reversed String : "<<str<<endl; getchar(); return 0; }
Output
Original String : Hello Reversed String : olleH