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 week of any given date. If a date is given in the form dd mm yyyy, then the day of the week d can be calculated using the following algorithm (a,b,c,d and m are all integers):
if mm is January or February then first subtract 1 from yyyy
a = the truncated value of (2.6m  0.2)
b = remainder when yyyy is divided by 100
c = yyyy/100
m is related to the month.
For March m has the value 1, April 2 ... December 10, January 11 and February 12.
d is the remainder when a + dd + b + b/4 + c/4  2c is divided by 7
if d is less than 0 then add 7 to d
d has the value 0 for Sunday, 1 for Monday, 2 for Tuesday etc.