#include #include #include #include //for ostream_iterator #include //for copy using namespace std; int main() { cout << "Please type integers. Press RETURN after each one.\n"; vector v; //int should be a typedef for (;;) { cout << "Next integer: "; int i; cin >> i; if (!cin) { break; } v.push_back(i); } cout << "\n"; copy(v.begin(), v.end(), ostream_iterator(cout, "\n")); return cin.eof() ? EXIT_SUCCESS : EXIT_FAILURE; } /* //copy does the following. for (vector:iterator it = v.begin(); it != v.end(); ++it) { cout << *it << "\n"; } */