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:
I have always wondered how the Easter date was figured out, Now I know ! :+D. I thought it was something to do with first full moon after Lent (whenever that is).
OK, with the formulae in your code, it seems everything is dependent on the year. So create a function which gets input for the start and ending year. Put some validation code in that function, use references so both values can be available in main's scope. Then have another function which takes years as an arguments, have a for loop, calculate the date and print it.
At the moment you do loop is not achieving much. And this year>=0001 doesn't work like you think it does. A leading zero on a number means that it is octal, it doesn't make any difference here, it's value is still 1, but try to avoid doing that. The number 1 is sufficient.
Does your formula still work for such an early date? The calendar was reorganised back in 1753 IIRC (I was 10 then :+D) They added in August at some point and there were other changes too.
Always initialise your variables to something, this is one of the biggest problems generally and will save you one day. Declare & initialise 1 variable per line, and put a comment to say what the name means.
Think about the types, could they all be unsigned? What happens if a negative value is put in?