Asked by Anonymous

Please, anyone who can help? pseudocode to display the next date of a Gregorian date given by a user considering a leap year. (just a language independent pseucode) I'm exhausted right now

Answers

Answered by Steve
assuming you have filled in an array (call it days) of 12 elements, each with the number of days in the month,

get date (m/d/y)
split into month,day,year

if day < days[month] then
&nbrsp;&nbrsp;day++
else if month < 12 then
&nbrsp;&nbrsp;day=1
&nbrsp;&nbrsp;month++
else
&nbrsp;&nbrsp;month=1
&nbrsp;&nbrsp;day=1
&nbrsp;&nbrsp;year++
endif
display month/day/year

You can also fill an array of month names, and display monthname[month] instead of the month number.
There are no AI answers yet. The ability to request AI answers is coming soon!