1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
#include <iostream>
#include <vector>

int
main()
{
    std::vector<char> text(5);
    text[0] = 'H';
    text[1] = 'e';
    text[2] = 'l';
    text[3] = 'l';
    text[4] = '!';

    //char text[6] = "Hello";

    // C++11
    for (char ch : text) {
        std::cout << ch << std::endl;
    }

    // Bis auf 'auto' pre-C++11
    /*
    for (auto it=text.begin(); it!=text.end(); ++it) {
        std::cout << *it << std::endl;
    }
    */

    /*
    for (std::vector<char>::iterator it=text.begin(); it!=text.end(); ++it) {
        std::cout << *it << std::endl;
    }
    */
}