// datetest.cpp #include #include #include #include "date.h" int matchCount(const Date&, const Date&); int main() { Date today(7,18,2001), finalDay; Date anotherDay(7,18,2002); finalDay.set(8,1,2001); cout << matchCount(today, today) << endl; cout << matchCount(today, anotherDay) << endl; cout << matchCount(anotherDay, finalDay) << endl; getch(); } // returns the number of fields the two date objects match on int matchCount(const Date &d1, const Date &d2) { int count=0; if (d1.getMonth() == d2.getMonth()) count++; if (d1.getDay() == d2.getDay()) count++; if (d1.getYear() == d2.getYear()) count++; return count; }