来人帮忙看下问题,谢谢!!
老提示 Type mismatch in parameter 1 in call to 'print' in function maini 不知道错出在哪,知道的麻烦说下#define N 10
struct student
{int num;
char name[10];
float score[3];
float aver;
};
main()
{int i,j;
struct student stu[N];
void print(struct student);<------ 必需要写完整形式void print(struct student stu[]);不然出错为什么啊
for(i=0;i<N;i++)
{printf("Input scores of student %d:\n",i+1);
printf("NO.:");
scanf("%d",&stu[i].num);
printf("name:");
scanf("%s",stu[i].name);
for(j=0;j<3;j++)
{printf("score %d:",j+1);
scanf("%f",&stu[i].score[j]);
}
print(stu);
}
void print(struct sudent stu[])
{ printf("NO. name score1 score2 score3 aver\n");
for(i=0;i<N;i++)
{average=0;
printf("%-3d%6s",stu[i].num,stu[i].name);
for(j=0;j<3;j++)
{printf("%8.2f",stu[i].score[j]);
average+=stu[i].score[j];
}
stu[i].aver=average/3.0;
printf("%8.2f\n",stu[i].aver);
}
}
[[it] 本帖最后由 zgzhly 于 2008-12-12 17:21 编辑 [/it]]