#include<stdio.h>#include<string.h>#include<stdlib.h>#define MAXN 100 //一个班最多的人数#define MAXM 2 //成绩的课程门数int R;void input(); //1.学生成绩新建void sort(); //2.学生成绩插入void load(); //3.学生成绩修改void print(); //4.学生成绩删除void total(); //5.学生成绩统计void search(); //6.学生成绩查询void save(); //7.学生成绩保存void end(); //8.结束struct student{char name[20]; //保存全班姓名char num[12]; //保存全班学号float score[MAXM]; //保存全班所有课程成绩float sum; //保存全班每个人的总成绩float avg; //保存每个人的平均成绩};struct student s[MAXN];struct http{char subject[20]; //保存全班所有课程};struct http c[MAXM];void main() //欢迎首界面{int select,l;system("color fC");printf("\n");printf("\n");printf("\n");printf("\n");printf(" ¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥\n"); printf(" * *\n"); printf(" * *\n"); printf(" * 欢迎进入终极一班学生管理系统 *\n"); printf(" * *\n"); printf(" * ︻┳═一 cf ... *\n"); printf(" * ┈━═☆甘总管的多塔生活∝╬══→ *\n");printf(" * *\n"); printf(" * 凸^-^凸凸^-^凸凸^-^凸凸^-^凸凸^-^凸凸^-^凸凸^-^凸 *\n"); printf(" ¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥\n"); printf(" ╭ v╮╔══╗╔╗╔╗╔╗╭'''╮\n");printf(" (@ ^o^ @)╚╗╔╝║║╔═╦╦╦═╗║╚╝╠═╦╦╗(~ : ~)\n");printf(" (~) : (~)╔╝╚╗║╚╣║║║║╠╣╚╗╔╣║║║║(~) v (~)\n");printf(" ╚══╝╚═╩═╩═╩═╝╚╝╚═╩═╝\n");printf("\n");printf("\n");printf(" 请按任意键进入下一界面\n");printf("------------------------------------------------------------------\n"); system("pause");system("color f2");system("color f1");system("color f3");system("color fE");system("color fB");system("color f5");system("color f9");system("color f6");system("color f1");system("color f3");system("color fE");system("color fB");system("color f5");system("color f9");system("color f6");system("color f1");system("color f3");system("color f5");system("color f9");system("color f6");system("color fD");system("pause");system("color fC");system("cls"); //上面是第一个界面while(1){system("cls");printf(" ****************欢迎进入终极一班学生管理系统****************\n");printf(" ******************************************************\n"); printf(" * ∝╬══→ 1.学生成绩新建囧rz 欢*\n");printf(" * ::======>> 2.学生成绩插入迎 *\n"); printf(" * ┈━═☆ 3.学生成绩修改来 *\n"); printf(" * ∝╬══→ 4.学生成绩删除到 *\n"); printf(" * ∝╬══→ 5.学生成绩统计英 *\n"); printf(" * ∝╬══→ 6.学生成绩查询雄 *\n"); printf(" * ▄︻┻═┳ 7.学生成绩保存联 *\n"); printf(" * ∝╬══→ 8.退出/撒拉嘿盟 *\n"); printf(" * (⊙_⊙)(⊙_⊙)(⊙_⊙)(⊙_⊙)(⊙_⊙)(⊙_⊙) *\n"); printf(" ******************************************************\n"); printf("\n"); printf("\n 请输入您的选择编号,回车键继续:\n");printf("---------------------------------------------------------------------------\n"); scanf("%d",&select);do{if(select<1||select>8){printf(" 您输入有误,请重新输入,谢谢!!!\n");scanf("%d",&select);}l=select;}while(l<1||l>8);switch(select){case 1:input();break; //1.学生成绩新建case 2:sort(); break; //2.学生成绩插入case 3:load(); break; //3.学生成绩修改case 4:print(); break; //4.学生成绩删除case 5:total();break; //5.学生成绩统计case 6:search();break; //6.学生成绩查询case 7:save();break; //7.学生成绩保存case 8: end();break; //8.结束default:printf(" 请按相应数学选择系统功能:");}}}void input() //1学生成绩输入成绩模块{int i,j,b;float a=0;printf(" 请输入该班同学的人数:\n");printf(" 班同学的人数在1~%d之间:\n",MAXN);scanf("%d",&R);do{if(R<1||R>100){printf(" 您输入有误,请重新输入,谢谢!!!\n");scanf("%d",&R);}b=R;}while(b<1||b>100);for(i=0;i<MAXM;i++){printf(" 请输入该班同学的第%d门课程名称为:\n",(i+1));scanf("%s", &c[i].subject);}for(i=0;i<R;i++){printf(" 请输入第%d个同学的姓名:\n",(i+1));scanf("%s",&s[i].name);printf(" 请输入第%d个同学的学号:\n",(i+1));scanf("%s",&s[i].num);printf(" 请依次输入%d门学科的成绩:\n",MAXM);for(j=0;j<MAXM;j++){printf(" 请输入课程%s的成绩为:\n",c[j].subject);scanf("%f",&s[i].score[j]);a=a+s[i].score[j];}s[i].sum=a;s[i].avg=s[i].sum/MAXM;a=0;}}void sort() //2学生成绩插入成绩模块{int i,j,k,b;float a=0;printf(" 请输入要插入的学生的位置1~%d号:\n",R);printf(" 第几个学生的位置之后:\n");scanf("%d",&k);do{if(k<1||k>R){printf(" 您输入有误,请重新输入,谢谢!!!\n");scanf("%d",&k);}b=k;}while(b<1||b>R);R=R+1;for(i=R;i>k;i--){strcpy(s[i].name,s[i-1].name);strcpy(s[i].num,s[i-1].num);s[i].sum=s[i-1].sum;s[i].avg=s[i-1].avg;for(j=0;j<MAXM;j++){s[i].score[j]=s[i-1].score[j];}}printf(" 请输入第%d个同学的姓名:\n",(k+1));scanf("%s",&s[k].name);printf(" 请输入第%d个同学的学号:\n",(k+1));scanf("%s",&s[k].num);printf(" 请依次输入%d门学科的成绩:\n",MAXM);for(j=0;j<MAXM;j++){printf(" 请输入课程%s的成绩为:\n",&c[j].subject);scanf("%f", &s[k].score[j]);a=a+s[k].score[j];}s[k].sum=a;s[k].avg=s[k].sum/MAXM;}void load() //3学生成绩修改{float a=0,h[MAXM];int i,j,b;printf(" 请输入修改学生的位置1~%d 号: \n",R);scanf("%d",&i);do{if(i<1||i>R){printf(" 您输入有误,请重新输入,谢谢!!!\n");scanf("%d",&i);}b=i;}while(b<1||b>R);printf(" 请输入%d号的新学号: \n",i);scanf("%s",&s[i-1].name);printf(" 请输入%d号的新姓名: \n",i);scanf("%s",&s[i-1].num);for(j=0;j<MAXM;j++){printf(" 请输入课程%s的成绩为:\n",&c[j].subject);scanf("%f",&h[j]);s[i-1].score[j] =h[j];a=a+s[i-1].score[j];}s[i-1].sum=a;s[i-1].avg=s[i-1].sum/MAXM;}void print() //4学生成绩删除{int i,j,k,b;printf(" 请输入删除学生的位置1~%d 号:\n",R);scanf("%d",&k);do{if(k<1||k>R){printf(" 您输入有误,请重新输入,谢谢!!!\n");scanf("%d",&k);}b=k;}while(b<1||b>R);i=k-1;for(i;i<R;i++){strcpy(s[i].name,s[i+1].name);strcpy(s[i].num,s[i+1].num);s[i].sum=s[i+1].sum;s[i].avg=s[i+1].avg;for(j=0;j<MAXM;j++){s[i].score[j]=s[i+1].score[j];}}R=R-1;printf("删除成功! \n");}void total() //5.学生成绩统计{int i,j;float a[MAXM],b=0;printf("学号:姓名:课程%s的分数:课程%s的分数: 总成绩:平均成绩:\n",c[0].subject,c[1].subject);for(i=0;i<R;i++){printf("%s%10.2s%16.2f%16.2f%16.2f%16.2f\n",s[i].num,s[i].name,s[i].score[0] ,s[i].score[1],s[i].sum,s[i].avg);}for(i=0;i<MAXM;i++){for(j=0;j<R;j++){b=b+s[j].score[i];}a[i]=b/R;b=0;}for(i=0;i<MAXM;i++){printf(" 全班课程%s的平均分为:%f \n",c[i].subject,a[i]);}printf("排序完毕.\n");system("pause");}void search() //6查询成绩模块{int search1();int search2();int select,index,b;while(1){printf("*************************************************************\n");printf(" * 1.按学号查询 * \n");printf(" * 2.按姓名查询 * \n");printf(" * 0.返回 * \n");printf(" * 请输入您的选择编号: * \n");printf("*************************************************************\n");scanf("%d",&select);do{if(select<0||select>2){printf(" 您输入有误,请重新输入,谢谢!!!\n");scanf("%d",&select);}b=select;}while(b<0||b>2);switch(select){case 1:index=search1(); break;case 2:index=search2();break;case 0:return;}if(index!=-1){int i;printf("*****************************************************************\n");printf(" 学号:%s \n", s[index].num);printf(" 姓名:%s \n", s[index].name);printf(" 总成绩:%f \n", s[index].sum);printf(" 平均成绩:%f \n", s[index].avg);for(i=0;i<MAXM;i++)printf(" 课程%s的成绩为:%f \n", c[i].subject,s[index].score[i]);printf("*****************************************************************\n");}else printf("没有这个同学。