#include #include using namespace std; int main() { // create a vector to store int vector vec; int i1; // display the original size of vec cout << "vector size = " << vec.size() << ":" << vec.capacity() << endl; // push 5 values into the vector for(i1 = 0; i1 < 5; i1++) { vec.push_back(i1); } // display extended size of vec cout << "extended vector size = " << vec.size() << ":" << vec.capacity() << endl; // access 5 values from the vector for(i1 = 0; i1 < 5; i1++) { cout << "value of vec [" << i1 << "] = " << vec[i1] << endl; } // use iterator to access the values vector::iterator iter = vec.begin(); while( iter != vec.end()) { cout << "value of v = " << *iter << endl; iter++; } return 0; }