#include #include #include #include #include "date.h" #include "istream_iterator_date.h" using namespace std; int main(int argc, char **argv) { ifstream ifs("infile"); if (!ifs) { cerr << argv[0] << ": couldn't open infile\n"; return EXIT_FAILURE; } const istream_iterator_date begin(ifs); const istream_iterator_date end; cout << "The file contains " << distance(begin, end) << " dates,\n"; const date crash(date::october, 29, 1929); //stock market const istream_iterator_date it = find(begin, end, crash); if (it == end) { cout << "not including " << crash << ".\n"; } else { cout << "including " << crash << ".\n"; } return EXIT_SUCCESS; }