帮我看看函数调用数组结构里哪里错了
错误 2 error C2664: “count”: 不能将参数 2 从“month [12]”转换为“const month” f:\program files\program\study\study\countdays.cpp 41 Study
程序代码:
#include "stdafx.h"
#define STAR "****************************"
/*月份结构*/
const struct month
{
char *name;
char sname[4];
int days;
int months;
};
/*计算输入月份以及以前的天数*/
int count(int, const struct month);
int main(void)
{
struct month mymonth[12]=
{
{"January","jan",31,1},
{"Febuary","feb",28,2},
{"March","mar",31,3},
{"April","apr",30,4},
{"May","may",31,5},
{"June","jun",30,6},
{"July","jul",31,7},
{"Auguest","aug",31,8},
{"Sepetember","sep",30,9},
{"October","oct",31,10},
{"November","nov",30,11},
{"December","dec",31,12}
};
int i;
printf("%s%s",STAR,STAR);
printf("This program work out the days before(include) the month you entered.");
printf("%s%s",STAR,STAR);
/*有效性判断*/
while((scanf("%d",&i)!=1)||((i<1)||(i>12)))
{
printf("Please enter a number between 1 and 12, eg.:3. : ");
}
printf("The days are:%d",count(i, mymonth));
return 0;
}
int count(int n, const struct month mon[])
{
int i,result;
for(i=0,result=0;i<n;i++)
{
result+=mon[i].days;
}
return result;
}






