1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
#include<iostream>
#include <string>
using std::cout;
using std::cin;
using std::endl;
using std::string;
int main()
{
int year, date, month, startingyear, endingyear;
string Months[]={"","January","February","March","April","May","June","July","August","September","October","November","December"};
int a, b, c, d, e, f, g, h, i, j, k, m, p;
do {
cout << "Enter Starting Year [Enter '0' to end program] : ";
cin >> startingyear;
cout << endl;
if(startingyear>0)
{
cout << "Enter Ending Year: ";
cin >> endingyear;
cout << endl;
for(year = startingyear;year < endingyear+1; year++)
{
a=year%19;
b=year/100;
c=year%100;
d=b/4;
e=b%4;
f=(b+8)/25;
g=(b-f+1)/3;
h=((19*a)+b-d-g+15)%30;
i=c/4;
j=c%4;
k=(32+(2*e)+(2*i)-h-j)%7;
m=(a+(11*h)+(22*k))/451;
month=(h+k-(7*m)+114)/31;
p=(h+k-(7*m)+114)%31;
date=p+1;
cout << "Easter Day in" << " " << year << " " << "is on " << Months[month] << " " << date << ", " << year;
cout << endl;
}
}
} while (startingyear > 0 && startingyear < 5001);
return 0;
}
|