求高手帮忙找下错!实在找不到啊
#include<stdio.h>int Run(int year)//判断是否为闰年
{
int run;
if(year%4==0&&year%100!=0||year%400==0)
run=1;
else
run=0;
return run;
}
int Panduan(int year,int month,int day)//判断输入日期是否正确
{
if(year<0||month<0||month>13||day<0||day>31)
printf("错误");
if(Run(year)==1&&month==2&&day>29)
printf("错误");
}
int Panduan2(int year1,int year2,int month1,int month2,int day1,int day2)//判断输入日期是否正确
{
if(year1>year2)
printf("错误");
if(year1==year2&&month1>month2)
printf("错误");
if(year1==year2&&month1==month2&&day1>day2)
printf("错误");
}
int monthday(int year,int month)//某个月有几天
{
int day;
if(Run(year)&&month==2)
day=29;
if(Run(year)!=1&&month==2)
day=28;
if(month==4||month==6||month==9||month==11)
day=30;
else
day=31;
return day;
}
int yearday(int year,int month,int day)//输入的日期为该年的第几天
{
int all,n;
for(all=0,n=1;n<month;n++)
all+=monthday(year,day);
all+=day;
return all;
}
int main()
{
int year1,year2,month1,month2,day1,day2,all1,all2,all3,count,n;
printf("请输入你的出生日期,如2015.1.1\n");
scanf("%d.%d.%d",&year1,&month1,&day1);
Panduan(year1,month1,day1);
printf("请输入现在的日期,如2015.1.1\n");
scanf("%d.%d.%d",&year2,&month2,&day2);
Panduan(year2,month2,day2);
Panduan2(year1,year2,month1,month2,day1,day2);
all1=yearday(year1,month1,day1);
all2=yearday(year2,month2,day2);
for(n=year1;n<year2;n++)
{if(Run(n))
{all3+=366;}
else
{all3+=365;}
}
count=all3+all2-all1;
printf("你活了%d天",count);
return 0;
}