#include #include #include #include using namespace std; int main () { // define an array of six ints const int SIZE = 6; int array[SIZE] = {1, 2, 3, 4, 5, 6}; // initalize a vector intVec with the above array vector intVec (array, array + SIZE); // set up an output iterator, with numbers separated by a " " ostream_iterator output (cout, " "); // display current vector cout << "Vector currently contains: "; copy(intVec.begin(), intVec.end(), output); // display front and back of vector cout << "Front of vector: " << intVec.front() << endl; cout << "Back of vector: " << intVec.back() << endl; // add three values to back of vector intVec.push_back(7); intVec.push_back(8); intVec.push_back(9); // display statistics about current vector cout << "Current size of vector: " << intVec.size() << endl; cout << "Current capacity of vector: " << intVec.capacity() << endl; // clear and display current vector intVec.clear(); }