Hello guys I need your help im really new in C++ and I need to do easter calculation to get the right easter day, at the moment I could get one year.
Example:
Year 2015
Easter Day in 2015 is/5/4/2015Year

but my professor is asking me to get year range

Example:
Year 2015 2020
Easter day in 2015 is 5/4/2015
Easter day in 2016 is 5/8/2016
........
Easter day in 2020 is ....

The problem that have is I don't know how to start at the moment I just have integer to calculate year how can I have two integers? and then guess I need while and increment or how can I do it ? please help me out guys! I would really appreciate this my code so far:

#include<iostream>
using namespace std;
int main()
{
    int year, date, month;
    int a, b, c, d, e, f, g, h, i, j, k, m, p;
    do {
        cout<< "Year ";
        cin >> 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"  << "/" << date  << "/" << month << "/" << year;

    }

    while (year>=0001&&year<=5000);


    return 0;


}

I'm really lost I think should do loop but I dont even know how to compare to years in the same calculation maybe increment ? im lost guys help me out..

Do your calculation in a function with as parameter a year and let your function return a date struct. Use this function in a loop.

When you create your function try to use meaningful names for your variables. Imagine trying to decipher what they mean 2 or 3 years in the future.

When does Easter Sunday occur?

Easter celebrates the resurrection of Jesus Christ. The day of Easter falls on a Sunday based on the lunisolar calendar, not a fixed date on the Gregorian or Julian calendar. It has been determined to fall on the Sunday after the full moon that occurs on or closest to March 21.

So, you need to determine when the full moon occures on or closest to March 21 for each year and then determine date that the following sunday occurs after that... :-) Have fun!

P.S. I was going to suggest using a Julian calender computation, but given this, that would not work! :-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.