#include "stdio.h"
main()
{
int year,month,day,nyear,nmonth,nday;
int days,dayn1=0,dayn2,iyear,dayyear;
int i;
int monthtable[]={31,28,31,30,31,30,31,31,30,31,30,31};
printf("birthday=");
scanf("d% d% d%",&year,&month,&day);
if(year<=0||month<1||month>12||day<=0||day>31)
printf("data error\n");
printf("year,month,day is");
scanf("d% d% d%",&nyear,&nmonth,&nday);
if(nyear<=0||nmonth<1||nmonth>12||nday<=0||nday>31)
printf("data error");
iyear=year;
for(;iyear<=nyear-1;iyear++)
{if((iyear%4==0&&iyear%100!=0)||iyear%400==0)
dayyear=366;
else
dayyear=365;
dayn1=dayn1+dayyear;
}
if((nyear%4==0&&nyear%100!=0)||nyear%400==0)
monthtable[1]=29;
dayn2=nday;
for(i=1;i<nmonth;i++)
{dayn2=dayn2+monthtable[i-1];
days=dayn1+dayn2;
}
printf("days isd%",days);
getch();
}
上面是小妹写的程序,但是在WIN-TC上能编译,但是只要运行第一个输入后,不经过运算,原样输出printf后的语句(不计算),不知怎搞的,望指教,么么。。