#include <stdio.h>
void main(void)
{
time_t timep
struct tm *p
int in_time[3]
int now_time[3]
int i
printf("输入年-月-日: ")
scanf("%d-%d-%d", &in_time[0], &in_time[1], &in_time[2])
time (&timep)
p=gmtime(&timep)
now_time[0]=1900+p->tm_year
now_time[1]=1+p->tm_mon
now_time[2]=p->tm_mday
for(i=0i<3i++)
if(in_time[i]>now_time[i])
{
printf("你输入的日期大\n")
break
}
else if(in_time[i]<now_time[i])
{
printf("你输入的日期小\n")
break
}
else
continue
if(i==3)
printf("两个日期一样大\n")
// printf("%d\n",p->tm_sec) /*获取当前秒*/
// printf("%d\n",p->tm_min) /*获取当前分*/
// printf("%d\n",8+p->tm_hour)/*获取当前时,这里获取西方的时间,刚好相差八个小时*/
// printf("%d\n",p->tm_mday)/*获取当前月份日数,范围是1-31*/
// printf("%d\n",1+p->tm_mon)/*获取当前月份,范围是0-11,所以要加1*/
// printf("%d\n",1900+p->tm_year)/*获取当前年份,从1900开始,所以要加1900*/
// printf("%d\n",p->tm_yday) /*从今年1月1日算起至今的天数,范围为0-365*/
}