C++ string Range-Based for loop on string value
#include <iostream> #include <string> using namespace std; int main(int argc, char *argv []) { /*w w w . jav a 2 s .c o m*/ string myString{ "This is my string!" }; for (char &letter : myString) { cout << letter << endl; } return 0; }