C++ string const_reverse_iterator
#include <iostream> #include <string> using namespace std; int main(int argc, char *argv []) { //from w w w . ja v a 2 s.c o m string myString{ "This is my string!" }; for (string::const_iterator iter = myString.cbegin(); iter != myString.cend(); ++iter) { cout << *iter << endl; } for (string::const_reverse_iterator iter = myString.crbegin(); iter != myString.crend(); ++iter) { cout << *iter << endl; } return 0; }