#include <iostream> #include <vector> using namespace std; int main() { vector<string> strs { "one", "two", "three", }; for (vector<string>::iterator it = strs.begin(); it != strs.end(); it++) { cout << *it << endl; } cout << "-----" << endl; // Vectorは動的配列用コンテナなので要素を追加できる strs.push_back("four"); strs.push_back("five"); for (vector<string>::iterator it = strs.begin(); it != strs.end(); it++) { cout << *it << endl; } return 0; }