I am trying to calculate the date of easter in the years 1900-2099 ,inclusive.And a,b,c,d,e variables are defined as in program and the date of easter is March 22+d+e(which may be in april),except in the years 1954,1981,2049 and 2076 when easter is one week earlier than the formula given.
From programming point of view,I am new and i tried the program as below but it is not in order and there are so many errors..how do i fix it..any help would be very helpful..
Now i have to request a starting and ending years from the user and validate input to make sure that lies in the range of years.I am new and i tried the program as below but it is not in order and there are so many errors..how do i fix it..any help would be very helpful..
#include<iostream>
#include<iomanip>
using namespace std;
void DisplayIntro();
enum Months {JAN,FEB,MAR ,APR ,MAY ,JUN ,
JUL ,AUG ,SEP ,OCT, NOV ,DEC }
void GetYears(int&Yr1,int&Yr2);
void EasterDay(int,int, Months&,int&);
bool MoreYears();
void main()
{
int Year1,Year2;
Months Month;
int Day;
DisplayIntro();
do{
GetYears(Year1,Year2);
for( Year1=1900;Year1<=2099;Year1++)
{
EasterDay(Year1,Year2,Month,Day);
if(Month==MAR)
cout<<"March";
else
cout<<"April";
cout<<setw(3)<< Day","<<setw(5)<<Year<<endl;
}
while(MoreYears());
cout << "\n Easter Day processing has ended.\n\n";
}
void displayIntro()
{
cout<<"EASTER DAY CALCULATION\n"
"\n Enter two starting and ending years "
"And the Easter days will be Displayed"
"The Starting year must not be after the ending year and both years
"\nmust be integers in the range 1900-2099.\n";
}
void GetYears(int&yr1,int&yr2)
{
cout<<"Enter the Starting and Ending years(Between 1900-2099 inclusive):";
cin>>yr1>>yr2;
}
void EasterDate (int Year1, Year2,MonthType & Month, int & Day )
{
int a,
b,
c,
d,
e,
calc
Year;
a=Year%19;
b=Year%4;
c=Year%7;
d=(19a+24)%30;
e=(2b+4c+6d+5)%7;
calc = 22+d+e;
if( calc> 31)
{
Month = April;
Day = calc - 31;
}
else
{
Month = March;
Day = calc;
}
}
if (int Year==1954||Year==1954||Year==1981||Year==1981||Year==2049||Year==2049||Year==2076||Year==2076)
{
Day = calc - 7;
}
bool MoreYears()
{
char response;
for (;;)
{
cout << "\nProcess more yeras? Enter Y for Yes or N for No: ";
cin >> response;
cin.ignore(256, '\n');
response = toupper(response);
if (response == 'Y' || response == 'N')
break;
cout << "Invalid response! Try again.\n";
}
return (response == 'Y');
}