1、#include#define N 8struct studentchar num10;char name10;float cscore; float mscore; float allscore; ;struct student strN;void paix(struct student str1);main()int i,n;float csum=0;float msum=0;float cjgl; float mjgl; float cave;float mave; int c=0; int m=0; char k10;char x;printf(“录入学生成绩请输入 ln“); sca
2、nf(“%s“,if(x=l)printf(“请输入学生数目:“);scanf(“%d“,printf(“学生人数为:%dn“,n);printf(“请输入学生的学号 姓名 语文成绩 数学成绩:n“);for(i=0;i=60)c+;if(stri.mscore=60)m+; cjgl=(float)c/n;mjgl=(float)m/n;cave=csum/n;mave=msum/n;paix(str);printf(“学生成绩如下:n“);printf(“学号 姓名 语文成绩 数学成绩 总分n“); for(i=0;iN;i+)printf(“%s %s %f %f %fn“,stri.n
3、um,stri.name,stri.cscore,stri.mscore,stri.allscore);printf(“语文科的平均分、及格率分别为:%f,%fn“,cave,cjgl);printf(“数学科的平均分、及格率分别为:%f,%fn“,mave,mjgl);printf(“请输入需要查询的学生姓名:n“);scanf(“%s“,if (k=stri.name)printf(“struct student stri“);else printf(“没有该学生n“);void paix(struct student str1)int i,j,n=N;float t;for(i=0;in;i+)for(j=0;jn-i;j+)if(strj.allscorestrj+1.allscore)t=strj.allscore;strj.allscore=strj+1.allscore;strj+1.allscore=t;for(i=0;in;i+);