源程序:
#include
#include
int main()
{
int year,month,day,sum;
int d[12]={0,31,59,90,120,151,181,212,243,273,304,334};
printf("Please enter the data:");
scanf("%d,%d,%d",&year,&month,&day);
if((year%4==0&&year%100!=0)||year%400==0)
sum=d[month-1]+day;
else
sum=d[month-1]+day+1;
printf("The days in this year:%d\n",sum);
getch();
}
d[month-1]中month是变量,如果想用可变的数组可以用malloc创建。
倒数第二行,getcher(),不是getch()。
还有,楼主你两个# include后面并没有写头文件。。