#include #include "date0.h" using namespace std; const int date0::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 }; date0::date0(int init_month, int init_day, int init_year) { if (init_month < 1 || init_month > 12) { cerr << "bad month " << init_month << "/" << init_day << "/" << init_year << "\n"; exit(EXIT_FAILURE); } if (init_day < 1 || init_day > length[init_month]) { cerr << "bad day " << init_month << "/" << init_day << "/" << init_year << "\n"; exit(EXIT_FAILURE); } } date0& date0::operator+=(int count) { for (int i {0}; i < count; ++i) { ++*this; //(*this).operator++(); } return *this; }