|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
请问这一题怎么解决?(用c语言)
9.2. Exercise
Calling time (NULL) gives you a large integer. Use this value to calculate today's year, date, hours, and minutes.
Simplifying assumption:we pretend that each year has exactly365 days. The 15th of March is therefore day 83 in year 2011. (use that date to figure out today's "day number")(hint: how many seconds are there in a day?)
You cannot use struct for this assignment.
You cannot use any time-based functions from the standard library such asasctime or strftime.
You must use one function to calculate the year and day(pass inthe total seconds, and a reference to the year and day).
You must use a separate function to calculate the hours andminutes.(again, pass the total seconds, and a reference to the hours and minutes)
You must use a separate function to print the time; this functioncan only take as arguments the year, day, hour, and minutes.
(optional: handle leap-years correctly, and print the month as well). |
|