All pastes #184529 Raw Edit

harten

public cpp v1 · immutable
#184529 ·published 2006-09-28 00:11 UTC
rendered paste body
// Chris Alexander CS125 Chapter 4 Assignment CS0401// .NET 2005  // XP Home/******************************************//* Easter Sunday Calculator: User Inputs  *//* the Year and it calculates the day     *//* Easter lands on that year.             *//******************************************/#include <iostream>#include <iomanip>using namespace std;int main() {	int year;	cout << "Easter Sunday Calculator\n";	cout << "Enter the year: ";                // User inputs year	cin  >> year;		// Calculates the day of the month in March for Easter Sunday	int a = year % 19;	int b = year % 4;	int c = year % 7;	int d = (19 * a + 24) % 30;	int e = (2 * b + 4 * c + 6 * d + 5) % 7;	int day = 22 + d + e;	// Calculation is off by 7 days for the following years	if (year == 1954 || year == 1981 || year == 2049 || year == 2076) {		day = day - 7;	}    // Calculates the day of month in April	if ( day > 31){ 		day = day - 31;		cout << "Easter Sunday is April ";	}	else {		cout << "Easter Sunday is March ";	}		// Output after calculations	cout << day << ", " << year <<  endl;	return 0;}