C++ string Looping over a String character by character

Description

C++ string Looping over a String character by character

#include <iostream> 
#include <string> 

using namespace std; 

int main(int argc, char *argv [])
{   //from   w ww.  j av  a  2  s. c o m
        string myString{ "This is my string!" }; 
        for (string::iterator iter = myString.begin(); iter != myString.end(); ++iter) 
        { 
                cout << *iter << endl; 
        } 
        return 0; 
}



PreviousNext

Related