I need to write the code in C++ for a calendar, using structs or classes, and then I need to write:
a function that returns 1 if the year given year is a leap year.
a function that given two dates, returns the number of days beetween them.
From what I understand there's mainly two ways to represnt a date:
1)Storing the day, month, and year
2)Storing the number of days since a reference date, e.g. January 1, 1900
However, I couldn't figure out how to handle the different amount of days in different months (e.g. February). I know it must be something simple because no one seems to mention it. Of course I'm not asking you to write any code for me, but if you could give me some tips on this matter I'd be extremely grateful.
every 4th year is a leap year, try to found specific year(not January 1, 1900) that is leap year and start count from there.