/// G. Hagopian
/// The user-defined type, Date

#include "..\std_lib_facilities.h"

#include "Date.h"

int main() {
try {
    Date today(2015,Date::Month::Apr,31);  /// today's date
    ///init_day(today,2015,4,28);
    cout << "\nToday's date is " << today;
    today.add_days(30);
    cout << "\nIn 30 days it will be " << today;
    //today.showDate();
    cout << "\n2016 is";
    if(!isLeapYear(2016)) cout << "not";
    cout << " a leap year";
    cout << " so 365 days later is";
    today.add_days(365);
    cout << today;
    Date my_birthday(1950,Date::Month::Dec,30);
    cout << my_birthday;
    Date today2 {2007,Date::Month::Dec,24};
    cout << endl;
    cout << today2;
     /// oops! run-time error
    today = today2;
    cout << "\nAfter assingment, today = " << today;
    Date last{2000,Date::Month::Jan,31}; /// OK (colloquial style)
    cout << endl;
    cout << last;

    Date next = {2014,Date::Month::Feb,14}; /// also OK (slightly verbose)
    Date christmas = Date{1976,Date::Month::Dec,24}; /// also OK (verbose style)
}
catch(Date::Invalid) {
    error("invalid date"); /// error() defined in §5.6.3
}
}
