#include "stdstuff.h" #include "Date.h" int main () { Date todayDate, birthDate, sentinelDate (1, 1, 2010); int daysOld; // prompt for and read in today's date cout << "Enter today's date (DD MM YYYY): "; todayDate.read(cin); for (;;) { // repeat until sentinel date is entered (where we will break out of loop) // prompt for and read in the birth date cout << "Enter the birth date in DD MM YYYY format (1 1 2010 to stop): "; birthDate.read(cin); // if the birth date entered is equal to our sentinel date (1 1 2010) we quit if (birthDate.compareTo(sentinelDate)==0) break; // calculate the age of the person and output it daysOld = todayDate.daysAfter(birthDate); cout << "This person is " << daysOld << " days old.\n"; // calculate if the person was born on a weekday (1-5) or weekend (6-7) and output the appropriate statement if (birthDate.dayInWeek() < 6) { cout << "This person was born on a weekday.\n"; } else { cout << "This person was born on a weekend.\n"; } // calculate when this person will be 10000 days old and output the date cout << "This person was / will be 10000 days old on "; birthDate.move(10000); birthDate.write(cout); cout << "\n"; } pause(); return 0; }