void fun(struct stu a)
{int i,j,h=0,l=0;
float hs=a[0].stuscore,sum=a[0].stuscore,aver,ls=a[0].stuscore
for(i=1;i<N;i++)
{ sum=sum+a[i].stuscore;
aver=sum/N;
if(a[i].stuscore>hs)h=i;
if(a[i].stuscore<ls)l=i;
}
printf("the data of the student a[%d] with highest score:%s,%f\n",h,a[h].stuno,a[h].stuscore);
printf("the data of the student a[%d] with lowest score:%s,%f,%f\n",l,a[l].stuno,a[l].stuscore);
printf("the average of the class:%f\n",aver);
}
#include <stdio.h>
#include <string.h>
#define N 3
struct stu
{
char stuno[10];
float stuscore;
}a[N]={{"20044590",69.53},{"20044591",70.56},{"20044594",65.90}};
main()
{int n,m;
int i,j,h=0,l=0;
float hs=a[0].stuscore,sum=a[0].stuscore,aver,ls=a[0].stuscore;
clrscr();
printf("the normal data of students:");
printf("\n");
printf(" number score\n");
printf("student 0 data: %s %f\n",a[0].stuno,a[0].stuscore);
for(i=1;i<N;i++)
{ sum=sum+a[i].stuscore;
aver=sum/N;
printf("student %d data: %s %f\n",i,a[i].stuno,a[i].stuscore);
if(a[i].stuscore>hs)h=i;
if(a[i].stuscore<ls)l=i;
}
printf("the data of the student a[%d] with highest score:%s,%f\n",h,a[h].stuno,a[h].stuscore);
printf("the data of the student a[%d] with lowest score:%s,%f,%f\n",l,a[l].stuno,a[l].stuscore);
printf("the average of the class:%f\n",aver);
getch();
return 0;
}
乱编的·!大家帮忙看看哪些地方用得不好的·!编译能通过并且基本功能能实现就是了~!