#include #include #include //for class vector using namespace std; int main() { vector v; //Born empty, but capable of holding doubles. for (;;) { cout << "Please input a double (or control-d when done): "; double d {0.0}; cin >> d; if (!cin) { //if the user typed control-d, break; //out of the for loop } v.push_back(d); //Call member function push_back belonging to v //cout << "v.size() = " << v.size() << "\n"; //cout << "capacity() = " << v.capacity() << "\n"; //doubles } cout << "\n\n"; cout << "Here are the " << v.size() << " doubles that you input:\n"; for (const auto& d: v) { //Loop through all the doubles in v. cout << d << "\n"; //d is a double because v holds doubles. } return EXIT_SUCCESS; //Nothing we have to remember to delete. }