/**
程序说明:很遗憾地告诉你,strptime()这个函数在Windows平台上是没有的,以下是在Linux系统编译运行的结果。
2017 05 04
今天: 2017 03 29
倒计时:离大赛还有36天燃乎
*/
#include <stdio.h>
#include <time.h>
int main()
{
int year,month,day;
time_t now;
char buf[64];
struct tm *today;
struct tm future;
int countdown;
scanf("%d%d%d",&year,&派拍month,&day);
sprintf(buf,"%d-%d-%d",year,month,day);
strptime(buf,"%Y-%m-%d",&future);
now=time(NULL);
today=localtime(&now);
countdown=future.tm_yday-today->tm_yday;
sprintf(buf,"%4d %02d %02d",today->tm_year 尘段羡+ 1900, today->tm_mon + 1, today->tm_mday);
printf("今天: %s\n",buf);
printf("倒计时:离大赛还有%d天\n",countdown);
return 0;
}