#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; } */ } |