#include #include #include #include //for ostream_iterator #include using namespace std; int main() { int a[] = {10, 30, 20}; const size_t n = sizeof a / sizeof a[0]; vector v(a, a + n); for (vector::reverse_iterator it = v.rbegin(); it != v.rend(); ++it) { cout << *it << "\n"; } cout << "\n"; ostream_iterator os(cout, "\n"); copy(v.rbegin(), v.rend(), os); cout << "\n"; sort(v.rbegin(), v.rend()); copy(v.begin(), v.end(), os); return EXIT_SUCCESS; }