由于笔者能力所限所以只是简易程序,供初学者学习:
#include#include #include #define n 100//此处自己更改void face(void);void choice(int m,char name[][20],double math[],double english[],double Clanguage[]);void input(char name[][20],double math[],double english[],double Clanguage[]);void ouput(char name[][20],double math[],double english[],double Clanguage[]);void sort_ouput(char name[][20],double math[],double english[],double Clanguage[]);void find_my(char name[][20],double math[],double english[],double Clanguage[]);void jige(char name[][20],double math[],double english[],double Clanguage[]);void averange(char name[][20],double math[],double english[],double Clanguage[]);int main(){ char name[n][20]; double math[n],english[n],Clanguage[n]; face(); int m; while(1){ scanf("%d",&m); if(m==0) break; else choice(m,name,math,english,Clanguage); } return 0;}void face(){ printf("欢迎光临学生成绩管理系统,很高兴能为你服务\n"); puts("*************************************************"); puts("The menu is as follows:"); puts("学生姓名与各科成绩的输入,请输入1来获得帮助"); puts("学生姓名与各科成绩的输出,请输入2来获得帮助"); puts("按学生总成绩从低到高排序并输出,请输入3来获得帮助"); puts("按学生姓名来查找学生成绩,请输入4来获得帮助"); puts("输出及格的学生姓名和成绩,请输入5来获得帮助"); puts("计算学生平均成绩并且输出,请输入6来获得帮助"); printf("说明:成绩以百分制,及格分数为\n每科分数都达到六十分来计算\n"); printf("输入输出格式为:Name Math English Clanguage\n"); puts("请输入0来关闭学生成绩管理系统 $*(0@0)*$ thank you");}void choice(int m,char name[][20],double math[],double english[],double Clanguage[]){ switch(m) { case 1:input(name,math,english,Clanguage);break; case 2:ouput(name,math,english,Clanguage);break; case 3:sort_ouput(name,math,english,Clanguage);break; case 4:find_my(name,math,english,Clanguage);break; case 5:jige(name,math,english,Clanguage);break; case 6:averange(name,math,english,Clanguage);break; }}void input(char name[n][20],double math[],double english[],double Clanguage[]){ int i; for(i=0;i =60) flag+=1; if(english[i]>=60) flag+=1; if(Clanguage[i]>=60) flag+=1; if(flag==3) printf("%s Math%.2lf English%.2lf Clanguage%.2lf",name[i],math[i],english[i],Clanguage[i]); else flag=0; }}void averange(char name[][20],double math[],double english[],double Clanguage[]){ printf("学生平均成绩:\n"); double aver=0; int i=0; double m=0,e=0,c=0; for(i=0;i