#include #include #include //for ostream_iterator #include "date.h" using namespace std; int main(int argc, char **argv) { ofstream ofs("outfile"); if (!ofs) { cerr << argv[0] << ": couldn't open outfile\n"; return EXIT_FAILURE; } const date a[] = { date(date::july, 4, 1776), date(date::october, 29, 1929), date(date::december, 7, 1941) }; const size_t n = sizeof a / sizeof a[0]; ostream_iterator it(ofs, "\n"); for (const date *p = a; p < a + n; ++p, ++it) { *it = *p; } return EXIT_SUCCESS; }