开发者

Days to Next Thursday

I m trying to write a code in C on caclulating days until next thursday. I need help, using this paragrah. http://en.wikipedia.org/wiki/Doomsday_rule#Finding_the_day_of_the_week_of_a_given_calendar_date

any ideas on how i should apporac开发者_如何学运维h it, and rough guideline


Separate your problem in smaller problems.

When you feel like a smaller problem is small enough to solve, solve that problem.

For instance: your master problem is "using the technique described in the wikipedia article calculate how many days are there till next Thursday".

Problems small enough to make into a function:

  • calculate (or lookup) a year's doomsday (Monday for 2011) yeardoomsday(2011)
  • calculate (or lookup) a month doomsday (7 for March) monthdoomsday(2011, 3)
    calls yeardoomsday(2011) somewhere inside the function
  • ...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜