#include #include "date.h" using namespace std; const int date::length[] = { 0, //dummy entry so that january will have subscript 1 31, //january 28, //february 31, //march 30, //april 31, //may 30, //june 31, //july 31, //august 30, //september 31, //october 30, //november 31 //december }; date::date(int initial_month, int initial_day, int initial_year) { if (initial_month < january || initial_month > december) { cerr << "bad month " << initial_month << "/" << initial_day << "/" << initial_year << "\n"; exit(EXIT_FAILURE); } if (initial_day < 1 || initial_day > length[initial_month]) { cerr << "bad day " << initial_month << "/" << initial_day << "/" << initial_year << "\n"; exit(EXIT_FAILURE); } } date& date::operator+=(int count) { while (--count >= 0) { ++*this; //(*this).operator++(); } return *this; } date& date::operator++() { cerr << "can't call date::operator++\n"; exit(EXIT_FAILURE); } void date::print(ostream& ost) const { cerr << "can't call date::print\n"; exit(EXIT_FAILURE); }