Gregorian Calendar | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Gregorian Calendar

Hi guys I have problem in making a calendar that gets some number and add them to a date For example My date is 4/5/2020 And I want to for example add200 days in that date Would you please suggest a syntax for it in c++?

8th Oct 2020, 12:33 PM
Fram
Fram - avatar
2 Answers
0
Hi Mike The main considerations here are representing a date as the nth day of a year, and the opposite: converting the nth day of a year to a date. https://stackoverflow.com/a/13242847 Try using the logic from this answer for your problem. It doesn't account for leap years though. If you're stuck, look at the solution I just uploaded. I think there's no bugs but let me know if there's anything https://code.sololearn.com/czXevRSXD2di
8th Oct 2020, 10:07 PM
Zena
Zena - avatar
+ 1
Thanks Zena Your code was helpful
9th Oct 2020, 7:34 AM
Fram
Fram - avatar