C++ string::reverse_iterator Move backward through a string from end to beginning

Description

C++ string::reverse_iterator Move backward through a string from end to beginning

#include <iostream> 
#include <string> 

using namespace std; 

int main(int argc, char *argv [])
{   //from w  ww . j a v  a 2s  .co m
        string myString{ "This is my string!" }; 

        for (string::reverse_iterator iter = myString.rbegin(); iter != myString.rend(); ++iter) 
        { 
                cout << *iter << endl; 
        } 
        return 0; 
}



PreviousNext

Related