前面的编译等都没错,程序运行时错误!!
从键盘输入年月日,计算该日是该年的第几天#include <stdio.h>
void main()
{
int year;
int month;
int day;
int days;
int i,l;
static int t[][13]={{0,31,28,31,30,31,30,31,31,30,31,30,31},{0,31,29,31,30,31,30,31,31,30,31,30,31}};
l: printf("%d,%d,%d",&year,&month,&day);
if(year<0||month<1||day>31||month>12)
{
printf("error!");
goto l;
}
l=0;
days=day;
if(year%4==0&&year%100==0||year%100==0)
l=1;/*闰年为t[1][13]*/
i=1;
while(i<month)
{
days+=t[1][i];
i++;
}
printf("days=%d",days);
}