The class should be capable of storing, manipulating and printing dates. Dates can be initialized by assigning 3 numbers - the day, the month and the year (initially restricted to any date after 1st January 1900 and before the year 3000)

e.g. Date d1(26,3,1999);

Dates will be printed by either of two member functions:

d1.print_nz();  // outputs 26/03/1999
d1.print_text();    // outputs Friday, 26th March 1999

or by the overloaded << operator:

cout << d1;     // outputs Friday, 26th March 1999

Dates can be manipulated by adding a number of days (from 0 to 999,999) - either by calling a function:

d1.add(1234);

or by using the overloaded + operator:

d2 = d1 + 1234;

#include <iostream.h>                   |   #include <iostream.h>
#include "a3.h"                     |   #include "a3.h"
using namespace B;              |   using namespace B;
                        |
int main() {                    |   int main() {
   Date d1(26,3,1999),d2;           |      Date d1(1,1,2000);
                        |
   d1.print_nz();               |      d1.print_nz();
   cout << endl;                |      cout << endl;
   d2 = d1 + 6;                     |      d1.add(999999);
   cout << d2 << endl;                  |           d1.print_text();
}                       |      cout << endl;
                        |   }

produces as output:

26/03/1999                  |   01/01/2000
Thursday, 1st April 1999            |   Saturday, 27th November 4737

There are 365 days in a year, except for leap years, when there are 366. Leap years are all divisible by 4 and not 100, except that those divisible by 400 are leap years. So 2100 and 2200 are not leap years, 2000 2004 2008 2400 are leap years.

Zeller’s Congruence is a method for finding the day of the ...