结构体问题
今晚上机测验,好多同学做不出来,我做了但出错。出错是因为什么原因,怎么改啊?
#include<stdio.h>
void main()
{
struct student
{
int number[1];
char name[10];
float chji[5];
}stu[4]={{1,"lily",72.3}, /*初始化*/
{2,"yaoming",100},
{3,"kobe",95.5},
{4,"jame",86}
};
int i,k;
float max=0;
for(i=0;i<4;i++)/*找成绩最高的*/
{
if(max<stu[i].chji)/*illegal use of floating point in function main*/
{
max=stu[i].chji; /*illegal use of floating point in function main*/
k=i; /*保存学生号*/
}
}
printf("the higest score is %f,the student is student%d",max,k); /*输出最高成绩与学生号*/
} /*'stu is assigned a value which is never used in function main*/