#include #include //for the i/o manipulator setw ("set width") #include #include //for class vector using namespace std; int main() { vector v { //Born holding 6 doubles, but we will expand it to 7. 0.5, 10.5, 20.5, 30.5, 40.5, 50.5 }; vector::size_type n {v.size()}; //number of elements in vector cout << "The vector was born holding these " << n << " doubles:\n"; for (int i {0}; i < n; ++i) { cout << i << " " << setw(2) << v[i] << "\n"; } cout << "\n"; v.push_back(60.5); //Add a new element to the end of the vector. n = v.size(); //We just changed the size of the vector from 6 to 7. cout << "Now the vector holds these " << n << " doubles:\n"; for (int i {0}; i < n; ++i) { cout << i << " " << setw(2) << v[i] << "\n"; } return EXIT_SUCCESS; }