C++ examples for STL:string
Copy the string to another string, but backward, use reverse iterators
#include <string> #include <iostream> using namespace std; int main() {/*from w w w. j a va 2 s .co m*/ std::string s = "this is a test"; std::string rs; rs.assign(s.rbegin(), s.rend()); cout << rs; }