帮我做个开学倒记时的.我门开学时间是2008年2月24日.

来源:百度知道 编辑:UC知道 时间:2024/05/21 15:52:53
我要要可爱点哒....谢谢哪个哥哥姐姐帮帮我`我弄空间上```嘿嘿`````

#include <stdio.h>
#include <time.h>
#include <stdlib.h>

int main(void)
{
struct tm when,result;
time_t now,test;

time( &now );
when = *localtime( &now );
printf("今天是%d月%d日\n", when.tm_mon+1,when.tm_mday);
result = when;
result.tm_mday =24;
if( (test = mktime( &result )) != (time_t)-1 )
printf( "距离2月24日开学还差%d天!\n",result.tm_mday-when.tm_mday+31 );
return 0;
}