[C++]Algorithm for adding days to an abstract date, eg. year that has 13 months, 13th month has 40 days -
i have task twist, , don't know start. need write function add days given date (dd/mm/yyyy), , return date in result, problem is, year not neccessarily needs georgian, eg. can have 13 months, 13th month has 40 days. not need code, need kind of algorithm know, start. tried use julian day number, cannot edit needs. if has suggestions, they'd appreciated. cannot use wrappers time_t
you can write 2 functions:
int datetoday(const date& date); date daytodate(int day);
which convert date days spent since 00/00/00 , in calendar (this straightforward, , can expressed in generic formulas - need know month per year, , days per each month define calendar + logic leap years). after that, can add day date by
date result_date = daytodate(datetoday(start_date)+days_to_add);