C++ string Looping Decrementing string::iterator

Description

C++ string Looping Decrementing string::iterator

#include <iostream> 
#include <string> 

using namespace std; 

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


        for (string::iterator iter = myString.end()-1; iter != myString.begin(); --iter) 
        { 
                cout << *iter << endl; 
        } 
        return 0; 
}



PreviousNext

Related