You are viewing a single comment's thread. Return to all comments →
string dayOfProgrammer(int year) { int totalDays = 215; bool leapYear = false; if(year < 1918) { //Julian calendar if(year%4 == 0) { leapYear = true; } } else if(year > 1918) { //Gregorian calendar if(year%400 == 0 || (year%4 == 0 && year%100 != 0)) { leapYear = true; } } else { //Julian-Gregorian transition calendar totalDays += 15; } if(leapYear) { totalDays += 29; } else if(year != 1918) { totalDays += 28; } string sepDate = to_string(256 - totalDays); sepDate += ".09."; return (sepDate += to_string(year)); }
Seems like cookies are disabled on this browser, please enable them to open this website
Day of the Programmer
You are viewing a single comment's thread. Return to all comments →