#include #include #include #include //for 2- and 3-argument sort #include //for greater #include "date.h" using namespace std; template void print(ITERATOR first, ITERATOR last) { for (; first != last; ++first) { cout << *first << "\n"; } } int main() { int a[] = {1969, 2001, 1941, 1929, 1776}; const size_t n = sizeof a / sizeof a[0]; sort(a, a + n); print(a, a + n); cout << "\n"; const date da[] = { date(date::july, 20, 1969), date(date::september, 11, 2001), date(date::december, 7, 1941), date(date::october, 29, 1929), date(date::july, 4, 1776) }; const size_t dn = sizeof da / sizeof da[0]; vector v(da, da + dn); sort(v.begin(), v.end(), greater()); print(v.begin(), v.end()); return EXIT_SUCCESS; }