/* 8)	Redo Assignment 2 so that the program keeps executing (i.e. it 
keeps asking the user to enter a year and it keeps displaying the Easter 
day for that year until the user decided to stop).
*/

#include <iostream>
#include <string>
using namespace std;
int main()
{
	int year, a, b, c, d, e, day;
	char ch = 'y';
	while (toupper(ch) == 'Y')
	{
		system("cls");
	cout << "Enter the year in a four-digit format "
		<< "(for example, 2002).\n"
		<< "The year must be between 1982 and 2048.\n";
	cin >> year;
	// Check if the year is in the range
	if ((year >= 1982) && (year <= 2048))
	{
		a = year % 19;
		b = year % 4;
		c = year % 7;
		d = (19 * a + 24) % 30;
		e = (2 * b + 4 * c + 6 * d + 5) % 7;
		day = 22 + d + e;
		cout << "\n\t";
		// If day > 31 change month to April and correct day.
		if (day > 31)
		{
			day = day % 31;
			cout << "Easter is Sunday, " << "April " 
				<< day << ", " << year << "." << "\n\n";
		}
		else
			cout << "Easter is Sunday, " << "March " 
			<< day << ", " << year << "." << "\n\n";
	}
	else  // year is not in the range
		cout << "\n\aInvalid Year (must be between "
			<< "1982 and 2048).\n\n" 

	cout << "Continue (if yes, press y or Y)? ";
	cin >> ch;
	}

	system("pause");

	return 0;

}


