C语言实现学生信息管理系统
- 1、需求分析
- 2、功能模块
- 3、效果展示
- 4、代码详解
- (1)学生信息结构体
- (2)学生信息的录入
- (3)学生信息的修改
- (4)学生信息的删除
- (5)学生信息的打印
- (6)学生信息的插入
- (7)学生信息的查询
- (8)学生成绩的排序
- (9)输出各科成绩不及格学生信息
- (10)输出各科成绩最高分学生信息
- (11)生成学生信息文件
- (12)读取文件学生信息
- (13)主程序
- 5、完整代码+注释
1、需求分析
- 利用C语言编写一个可以对学生成绩信息进行管理的系统
0、退出系统
1、录入学生信息和成绩
2、打印学生信息
3、统计学生人数
4、查找学生信息
5、修改学生信息
6、删除学生信息
7、排序学生成绩
8、生成学生信息文件
9、读取文件学生信息
10、输出各科成绩不及格学生信息
11、输出各科成绩最高分学生信息
12、计算学生成绩总分和平均分
2、功能模块
3、效果展示
- 系统可以对学生成绩信息进行录入、修改、查找、删除、插入、打印、保存、读取、排序、计算总分、平均分
4、代码详解
(1)学生信息结构体
struct Student //创建学生信息结构体{//每个学生对应一个结构体char ID[20]; //学号char Name[10]; //姓名float Score1; //英语成绩float Score2; //数学成绩float Score3; //语文成绩float Score4; //程序设计成绩float All; //总分float Average; //平均成绩} students[1000];
(2)学生信息的录入
void InputStudent() //利用循环录入学生信息{while (1){printf("请输入学号:");scanf("%s", &students[num].ID);getchar();printf("请输入姓名:");scanf("%s", &students[num].Name);getchar();printf("请输入成绩:");scanf("%f", &students[num].Score1);getchar();printf("请输入成绩:");scanf("%f", &students[num].Score2);getchar();printf("请输入成绩:");scanf("%f", &students[num].Score3);getchar();printf("请输入成绩:");scanf("%f", &students[num].Score4); //依次输入各项数据getchar();students[num].All = students[num].Score1 + students[num].Score2 + students[num].Score3 + students[num].Score4; //输完数据后自动计算总成绩与平均成绩students[num].Average = (students[num].Score1 + students[num].Score2 + students[num].Score3 + students[num].Score4) / 4;if (Student_SearchByIndex(students[num].ID) == -1){num++; //移向下一个位置}else{printf("学号重复,输入数据无效 !\n");}printf("是否继续" />);if (getchar() == 'n'){break;}}}
(3)学生信息的修改
void ModifyStudent() //修改学生成绩{while (1){char id[20];int index;printf("请输入要修改的学生的学号:");scanf("%s", &id);getchar();index = Student_SearchByIndex(id); //调用搜查id函数,根据其返回值确定位置if (index == -1){printf("学生不存在!\n");}else{printf("你要修改的学生信息为:\n");Student_DisplaySingle(index);printf("-- 请输入新值--\n");printf("请输入学号:");scanf("%s", &students[index].ID);getchar();printf("请输入姓名:");scanf("%s", &students[index].Name);getchar();printf("请输入英语成绩:");scanf("%f", &students[index].Score1);getchar();printf("请输入数学成绩:");scanf("%f", &students[index].Score2);getchar();printf("请输入语文成绩:");scanf("%f", &students[index].Score3);getchar();printf("请输入程序设计成绩:");scanf("%f", &students[index].Score4); //重新录入一套新的数据替代getchar();students[index].All = students[index].Score1 + students[index].Score2 + students[index].Score3 + students[index].Score4;students[index].Average = (students[index].Score1 + students[index].Score2 + students[index].Score3 + students[index].Score4) / 4;}printf("是否继续?(y/n):>");if (getchar() == 'n'){break;}}}
(4)学生信息的删除
void DeleteStudent() //删除学生信息{int i;while (1){char id[20];int index;printf("请输入要删除的学生的学号:");scanf("%s", &id);getchar();index = Student_SearchByIndex(id); //调用搜查id函数,根据其返回值确定位置if (index == -1){printf("该学生不存在!\n");}else{printf("你要删除的学生信息为:\n");Student_DisplaySingle(index);printf("是否真的要删除?(y/n)");if (getchar() == 'y'){for (i = index; i < num - 1; i++){Copy(students, i, i + 1);// students[i]=students[i+1];//把后边的对象都向前移动}num--;}getchar();}printf("是否继续?(y/n):>");if (getchar() == 'n'){break;}}}
(5)学生信息的打印
void display() //打印已录入的学生信息{int a;printf("%10s%10s%8s%8s%8s%8s%10s%10s\n", "学号", "姓名", "英语", "数学", "语文", "程序设计", "总成绩", "平均成绩");printf("-------------------------------------------------------------------------\n");for (a = 0; a < num; a++){printf("%10s%10s%8.2f%8.2f%8.2f%8.2f%10.2f%10.2f\n", students[a].ID, students[a].Name, students[a].Score1, students[a].Score2, students[a].Score3, students[a].Score4, students[a].All, students[a].Average);}}
(6)学生信息的插入
void InsertStudent() //指定位置插入学生信息{int a, b, c;printf("请输入你要插入的位置");scanf("%d", &a);if (a > num){printf("输入的位置有误,请重新输入,当前共%d条数据\n", num);scanf("%d", &a);}b = num - 1;for (; b >= a - 1; b--){// strcpy(students[b+1].ID,students[b].ID);// strcpy(students[b+1].Name,students[b].Name);// students[b+1].Score1=students[b].Score1;// students[b+1].Score2=students[b].Score2;// students[b+1].Score3=students[b].Score3;// students[b+1].Score4=students[b].Score4;// students[b+1].All=students[b].All;// students[b+1].Average=students[b].Average;Copy(students, b + 1, b); //根据其输入的位置,将其及以后的数据向后移动一个位置}num++;printf("请输入学号:");scanf("%s", &students[a - 1].ID);getchar();printf("请输入姓名:");scanf("%s", &students[a - 1].Name);getchar();printf("请输入英语成绩:");scanf("%f", &students[a - 1].Score1);getchar();printf("请输入数学成绩:");scanf("%f", &students[a - 1].Score2);getchar();printf("请输入语文成绩:");scanf("%f", &students[a - 1].Score3);getchar();printf("请输入程序设计成绩:");scanf("%f", &students[a - 1].Score4); //输入新数据getchar();students[a - 1].All = students[a - 1].Score1 + students[a - 1].Score2 + students[a - 1].Score3 + students[a - 1].Score4;students[a - 1].Average = (students[a - 1].Score1 + students[a - 1].Score2 + students[a - 1].Score3 + students[a - 1].Score4) / 4;}
(7)学生信息的查询
void search() //查询学生信息{while (1){char name[20];int index;printf("请输入要查询的学生的姓名:");scanf("%s", &name);getchar();index = Student_SearchByName(name); //调用搜查name函数,根据其返回值确定位置if (index == -1){printf("学生不存在!\n");}else{printf("你要查询的学生信息为:\n");Student_DisplaySingle(index);}printf("是否继续?(y/n):>");if (getchar() == 'n'){break;}}}
(8)学生成绩的排序
void SortStudent() //根据平均分排序{int i, j;// struct students tmp;for (i = 0; i < num; i++){students[i].Average = (students[i].Score1 + students[i].Score2 + students[i].Score3 + students[i].Score4) / 4;}for (i = 0; i < num; i++){for (j = 1; j < num - i; j++){if (students[j - 1].Average < students[j].Average){Copy(students, num, j - 1);Copy(students, j - 1, j);Copy(students, j, num);// tmp=students[j-1];// students[j-1]=students[j];// students[j]=tmp;//冒泡排序}}}int a;printf("%10s%10s%8s%8s%8s%8s%10s%10s\n", "学号", "姓名", "英语", "数学", "语文", "程序设计", "总成绩", "平均成绩");printf("-------------------------------------------------------------------------\n");for (a = 0; a < num; a++){printf("%10s%10s%8.2f%8.2f%8.2f%8.2f%10.2f%10.2f\n", students[a].ID, students[a].Name, students[a].Score1, students[a].Score2, students[a].Score3, students[a].Score4, students[a].All, students[a].Average);}}
(9)输出各科成绩不及格学生信息
void SearchLow() //搜索不及格的并输出{int a;printf("英语不及格的有:%10s%10s%8s\n", "姓名", "学号", "英语");for (a = 0; a < num; a++){if (students[a].Score1 < 60)printf("\t\t%10s%10s%8.2f\n", students[a].Name, students[a].ID, students[a].Score1); //从头搜索到尾,若小于60就输出}printf("数学不及格的有:%10s%10s%8s\n", "姓名", "学号", "数学");for (a = 0; a < num; a++){if (students[a].Score2 < 60)printf("\t\t%10s%10s%8.2f\n", students[a].Name, students[a].ID, students[a].Score2);}printf("语文不及格的有:%10s%10s%8s\n", "姓名", "学号", "语文");for (a = 0; a < num; a++){if (students[a].Score3 < 60)printf("\t\t%10s%10s%8.2f\n", students[a].Name, students[a].ID, students[a].Score3);}printf("程序设计不及格的有%10s%10s%8s\n", "姓名", "学号","程序设计");for (a = 0; a < num; a++){if (students[a].Score4 < 60)printf("\t\t%10s%10s%8.2f\n", students[a].Name, students[a].ID, students[a].Score4);}system("pause");}
(10)输出各科成绩最高分学生信息
void SearchHigh() //搜索成绩最高者输出{int a;int max;printf("英语成绩最高分为%10s%10s%8s\n", "姓名", "学号", "英语");max = students[0].Score1;for (a = 1; a < num; a++){if (students[a].Score1 > max)max = students[a].Score1;}for (a = 0; a < num; a++){if (max == students[a].Score1)printf("\t\t%10s%10s%8.2f\n", students[a].Name, students[a].ID, students[a].Score1);}printf("数学成绩最高分为%10s%10s%8s\n", "姓名", "学号", "数学");max = students[0].Score2;for (a = 1; a < num; a++){if (students[a].Score2 > max)max = students[a].Score2;}for (a = 0; a < num; a++){if (max == students[a].Score2)printf("\t\t%10s%10s%8.2f\n", students[a].Name, students[a].ID, students[a].Score2);}printf("语文成绩最高分为%10s%10s%8s\n", "姓名", "学号", "语文");max = students[0].Score3;for (a = 1; a < num; a++){if (students[a].Score3 > max)max = students[a].Score3;}for (a = 0; a < num; a++){if (max == students[a].Score3)printf("\t\t%10s%10s%8.2f\n", students[a].Name, students[a].ID, students[a].Score3);}printf("程序设计最高分为%10s%10s%8s\n", "姓名", "学号", "程序设计");max = students[0].Score4;for (a = 1; a < num; a++){if (students[a].Score4 > max)max = students[a].Score4;}for (a = 0; a < num; a++){if (max == students[a].Score4)printf("\t\t%10s%10s%8.2f\n", students[a].Name, students[a].ID, students[a].Score4);}system("pause");}
(11)生成学生信息文件
void SaveStudent(){FILE *fp = fopen("student-information.txt", "w+");fprintf(fp, "%d\n", num);for (int i = 0; i < num; i++){fprintf(fp, "%s %s %f %f %f %f %f %f\n", students[i].ID, students[i].Name, students[i].Score1, students[i].Score2, students[i].Score3, students[i].Score4, students[i].All, students[i].Average);}fclose(fp);printf("学生信息文件已保存在本地\n");}
(12)读取文件学生信息
void LoadInformation(){FILE *fp = fopen("student-information.txt", "r");fscanf(fp, "%d", &num);for (int i = 0; i < num; i++){fscanf(fp, "%s %s %f %f %f %f %f %f\n", students[i].ID, students[i].Name, &students[i].Score1, &students[i].Score2, &students[i].Score3, &students[i].Score4, &students[i].All, &students[i].Average);}fclose(fp);printf("系统已读取文件学生信息\n");}
(13)主程序
/*主程序*/int main(){int i;while (1){LoadInformation();printf("-------------------------------------------------------------------------\n");printf(" 请选择系统功能 \n");printf("-------------------------------------------------------------------------\n");printf("欢迎使用高校学生信息管理系统 \n");printf("-------------------------------------------------------------------------\n");printf(" 0.退出系统\n");printf(" 1.学生信息的录入\n");printf(" 2.学生信息的修改\n");printf(" 3.学生信息的删除\n");printf(" 4.学生信息的插入\n");printf(" 5.学生信息的打印\n");printf(" 6.学生信息的查找\n");printf(" 7.学生成绩的排序\n");printf(" 8.生成学生信息文件\n");printf(" 9.读取学生信息文件\n");printf("10.输出各科不及格学生信息\n");printf("11.输出各科最高分学生信息\n");printf("-------------------------------------------------------------------------\n");printf("--------------------------------作者: wink-------------------------------\n");printf("请选择(0-11):>");scanf("%d", &i);switch (i){case 1:InputStudent();break;case 2:ModifyStudent();break;case 3:DeleteStudent();break;case 4:InsertStudent();break;case 5:display();break;case 6:search();break;case 7:SortStudent();break;case 8:SaveStudent();break;case 9:LoadInformation();break;case 10:SearchLow();break;case 11:SearchHigh();break;case 0:printf("Thanks for using, See you again !");exit(0);default:;}}return 0;}
5、完整代码+注释
#include #include #include #include struct Student //创建学生信息结构体{//每个学生对应一个结构体char ID[20]; //学号char Name[10]; //姓名float Score1; //英语成绩float Score2; //数学成绩float Score3; //语文成绩float Score4; //程序设计成绩float All; //总分float Average; //平均成绩} students[1000];int num = 0; //计数器void Copy(struct Student *arr, int i, int j){strcpy(arr[i].ID, arr[j].ID);strcpy(arr[i].Name, arr[j].Name);arr[i].Score1 = arr[j].Score1;arr[i].Score2 = arr[j].Score2;arr[i].Score3 = arr[j].Score3;arr[i].Score4 = arr[j].Score4;arr[i].All = arr[j].All;arr[i].Average = arr[j].Average;}int Student_SearchByName(char name[]) //通过姓名来检索学生{int i;for (i = 0; i < num; i++){if (strcmp(students[i].Name, name) == 0) //通过strcmp函数来对比学生姓名,找到返回在数组的位置{return i;}}return -1; //未找到返回 -1}int Student_SearchByIndex(char id[]) //通过学号来检索学生信息{int i;for (i = 0; i < num; i++){if (strcmp(students[i].ID, id) == 0) //通过strcmp函数来对比学生id,找到返回位置{return i;}}return -1; //未找到返回 -1}void Student_DisplaySingle(int index) //输出表头{printf("%10s%10s%8s%8s%8s%10s\n", "学号", "姓名", "英语", "数学", "语文", "程序设计", "总成绩", "平均成绩");printf("-------------------------------------------------------------\n");printf("%10s%10s%8.2f%8.2f%8.2f%8.2f%10.2f%10.2f\n", students[index].ID, students[index].Name,students[index].Score1, students[index].Score2, students[index].Score3, students[index].Score4, students[index].All, students[index].Average);}void InputStudent() //利用循环录入学生信息{while (1){printf("请输入学号:");scanf("%s", &students[num].ID);getchar();printf("请输入姓名:");scanf("%s", &students[num].Name);getchar();printf("请输入成绩:");scanf("%f", &students[num].Score1);getchar();printf("请输入成绩:");scanf("%f", &students[num].Score2);getchar();printf("请输入成绩:");scanf("%f", &students[num].Score3);getchar();printf("请输入成绩:");scanf("%f", &students[num].Score4); //依次输入各项数据getchar();students[num].All = students[num].Score1 + students[num].Score2 + students[num].Score3 + students[num].Score4; //输完数据后自动计算总成绩与平均成绩students[num].Average = (students[num].Score1 + students[num].Score2 + students[num].Score3 + students[num].Score4) / 4;if (Student_SearchByIndex(students[num].ID) == -1){num++; //移向下一个位置}else{printf("学号重复,输入数据无效 !\n");}printf("是否继续?(y/n):>");if (getchar() == 'n'){break;}}}void ModifyStudent() //修改学生成绩{while (1){char id[20];int index;printf("请输入要修改的学生的学号:");scanf("%s", &id);getchar();index = Student_SearchByIndex(id); //调用搜查id函数,根据其返回值确定位置if (index == -1){printf("学生不存在!\n");}else{printf("你要修改的学生信息为:\n");Student_DisplaySingle(index);printf("-- 请输入新值--\n");printf("请输入学号:");scanf("%s", &students[index].ID);getchar();printf("请输入姓名:");scanf("%s", &students[index].Name);getchar();printf("请输入英语成绩:");scanf("%f", &students[index].Score1);getchar();printf("请输入数学成绩:");scanf("%f", &students[index].Score2);getchar();printf("请输入语文成绩:");scanf("%f", &students[index].Score3);getchar();printf("请输入程序设计成绩:");scanf("%f", &students[index].Score4); //重新录入一套新的数据替代getchar();students[index].All = students[index].Score1 + students[index].Score2 + students[index].Score3 + students[index].Score4;students[index].Average = (students[index].Score1 + students[index].Score2 + students[index].Score3 + students[index].Score4) / 4;}printf("是否继续?(y/n):>");if (getchar() == 'n'){break;}}}void DeleteStudent() //删除学生信息{int i;while (1){char id[20];int index;printf("请输入要删除的学生的学号:");scanf("%s", &id);getchar();index = Student_SearchByIndex(id); //调用搜查id函数,根据其返回值确定位置if (index == -1){printf("该学生不存在!\n");}else{printf("你要删除的学生信息为:\n");Student_DisplaySingle(index);printf("是否真的要删除?(y/n)");if (getchar() == 'y'){for (i = index; i < num - 1; i++){Copy(students, i, i + 1);// students[i]=students[i+1];//把后边的对象都向前移动}num--;}getchar();}printf("是否继续?(y/n):>");if (getchar() == 'n'){break;}}}void display() //打印已录入的学生信息{int a;printf("%10s%10s%8s%8s%8s%8s%10s%10s\n", "学号", "姓名", "英语", "数学", "语文", "程序设计", "总成绩", "平均成绩");printf("-------------------------------------------------------------------------\n");for (a = 0; a < num; a++){printf("%10s%10s%8.2f%8.2f%8.2f%8.2f%10.2f%10.2f\n", students[a].ID, students[a].Name, students[a].Score1, students[a].Score2, students[a].Score3, students[a].Score4, students[a].All, students[a].Average);}}void InsertStudent() //指定位置插入学生信息{int a, b, c;printf("请输入你要插入的位置");scanf("%d", &a);if (a > num){printf("输入的位置有误,请重新输入,当前共%d条数据\n", num);scanf("%d", &a);}b = num - 1;for (; b >= a - 1; b--){// strcpy(students[b+1].ID,students[b].ID);// strcpy(students[b+1].Name,students[b].Name);// students[b+1].Score1=students[b].Score1;// students[b+1].Score2=students[b].Score2;// students[b+1].Score3=students[b].Score3;// students[b+1].Score4=students[b].Score4;// students[b+1].All=students[b].All;// students[b+1].Average=students[b].Average;Copy(students, b + 1, b); //根据其输入的位置,将其及以后的数据向后移动一个位置}num++;printf("请输入学号:");scanf("%s", &students[a - 1].ID);getchar();printf("请输入姓名:");scanf("%s", &students[a - 1].Name);getchar();printf("请输入英语成绩:");scanf("%f", &students[a - 1].Score1);getchar();printf("请输入数学成绩:");scanf("%f", &students[a - 1].Score2);getchar();printf("请输入语文成绩:");scanf("%f", &students[a - 1].Score3);getchar();printf("请输入程序设计成绩:");scanf("%f", &students[a - 1].Score4); //输入新数据getchar();students[a - 1].All = students[a - 1].Score1 + students[a - 1].Score2 + students[a - 1].Score3 + students[a - 1].Score4;students[a - 1].Average = (students[a - 1].Score1 + students[a - 1].Score2 + students[a - 1].Score3 + students[a - 1].Score4) / 4;}void search() //查询学生信息{while (1){char name[20];int index;printf("请输入要查询的学生的姓名:");scanf("%s", &name);getchar();index = Student_SearchByName(name); //调用搜查name函数,根据其返回值确定位置if (index == -1){printf("学生不存在!\n");}else{printf("你要查询的学生信息为:\n");Student_DisplaySingle(index);}printf("是否继续?(y/n):>");if (getchar() == 'n'){break;}}}void SortStudent() //根据平均分排序{int i, j;// struct students tmp;for (i = 0; i < num; i++){students[i].Average = (students[i].Score1 + students[i].Score2 + students[i].Score3 + students[i].Score4) / 4;}for (i = 0; i < num; i++){for (j = 1; j < num - i; j++){if (students[j - 1].Average < students[j].Average){Copy(students, num, j - 1);Copy(students, j - 1, j);Copy(students, j, num);// tmp=students[j-1];// students[j-1]=students[j];// students[j]=tmp;//冒泡排序}}}int a;printf("%10s%10s%8s%8s%8s%8s%10s%10s\n", "学号", "姓名", "英语", "数学", "语文", "程序设计", "总成绩", "平均成绩");printf("-------------------------------------------------------------------------\n");for (a = 0; a < num; a++){printf("%10s%10s%8.2f%8.2f%8.2f%8.2f%10.2f%10.2f\n", students[a].ID, students[a].Name, students[a].Score1, students[a].Score2, students[a].Score3, students[a].Score4, students[a].All, students[a].Average);}}void SearchLow() //搜索不及格的并输出{int a;printf("英语不及格的有:%10s%10s%8s\n", "姓名", "学号", "英语");for (a = 0; a < num; a++){if (students[a].Score1 < 60)printf("\t\t%10s%10s%8.2f\n", students[a].Name, students[a].ID, students[a].Score1); //从头搜索到尾,若小于60就输出}printf("数学不及格的有:%10s%10s%8s\n", "姓名", "学号", "数学");for (a = 0; a < num; a++){if (students[a].Score2 < 60)printf("\t\t%10s%10s%8.2f\n", students[a].Name, students[a].ID, students[a].Score2);}printf("语文不及格的有:%10s%10s%8s\n", "姓名", "学号", "语文");for (a = 0; a < num; a++){if (students[a].Score3 < 60)printf("\t\t%10s%10s%8.2f\n", students[a].Name, students[a].ID, students[a].Score3);}printf("程序设计不及格的有%10s%10s%8s\n", "姓名", "学号","程序设计");for (a = 0; a < num; a++){if (students[a].Score4 < 60)printf("\t\t%10s%10s%8.2f\n", students[a].Name, students[a].ID, students[a].Score4);}system("pause");}void SearchHigh() //搜索成绩最高者输出{int a;int max;printf("英语成绩最高分为%10s%10s%8s\n", "姓名", "学号", "英语");max = students[0].Score1;for (a = 1; a < num; a++){if (students[a].Score1 > max)max = students[a].Score1;}for (a = 0; a < num; a++){if (max == students[a].Score1)printf("\t\t%10s%10s%8.2f\n", students[a].Name, students[a].ID, students[a].Score1);}printf("数学成绩最高分为%10s%10s%8s\n", "姓名", "学号", "数学");max = students[0].Score2;for (a = 1; a < num; a++){if (students[a].Score2 > max)max = students[a].Score2;}for (a = 0; a < num; a++){if (max == students[a].Score2)printf("\t\t%10s%10s%8.2f\n", students[a].Name, students[a].ID, students[a].Score2);}printf("语文成绩最高分为%10s%10s%8s\n", "姓名", "学号", "语文");max = students[0].Score3;for (a = 1; a < num; a++){if (students[a].Score3 > max)max = students[a].Score3;}for (a = 0; a < num; a++){if (max == students[a].Score3)printf("\t\t%10s%10s%8.2f\n", students[a].Name, students[a].ID, students[a].Score3);}printf("程序设计最高分为%10s%10s%8s\n", "姓名", "学号", "程序设计");max = students[0].Score4;for (a = 1; a < num; a++){if (students[a].Score4 > max)max = students[a].Score4;}for (a = 0; a < num; a++){if (max == students[a].Score4)printf("\t\t%10s%10s%8.2f\n", students[a].Name, students[a].ID, students[a].Score4);}system("pause");}void SaveStudent(){FILE *fp = fopen("student-information.txt", "w+");fprintf(fp, "%d\n", num);for (int i = 0; i < num; i++){fprintf(fp, "%s %s %f %f %f %f %f %f\n", students[i].ID, students[i].Name, students[i].Score1, students[i].Score2, students[i].Score3, students[i].Score4, students[i].All, students[i].Average);}fclose(fp);printf("学生信息文件已保存在本地\n");}void LoadInformation(){FILE *fp = fopen("student-information.txt", "r");fscanf(fp, "%d", &num);for (int i = 0; i < num; i++){fscanf(fp, "%s %s %f %f %f %f %f %f\n", students[i].ID, students[i].Name, &students[i].Score1, &students[i].Score2, &students[i].Score3, &students[i].Score4, &students[i].All, &students[i].Average);}fclose(fp);printf("系统已读取文件学生信息\n");}/*主程序*/int main(){int i;while (1){LoadInformation();printf("-------------------------------------------------------------------------\n");printf(" 请选择系统功能 \n");printf("-------------------------------------------------------------------------\n");printf("欢迎使用高校学生信息管理系统 \n");printf("-------------------------------------------------------------------------\n");printf(" 0.退出系统\n");printf(" 1.学生信息的录入\n");printf(" 2.学生信息的修改\n");printf(" 3.学生信息的删除\n");printf(" 4.学生信息的插入\n");printf(" 5.学生信息的打印\n");printf(" 6.学生信息的查找\n");printf(" 7.学生成绩的排序\n");printf(" 8.生成学生信息文件\n");printf(" 9.读取学生信息文件\n");printf("10.输出各科不及格学生信息\n");printf("11.输出各科最高分学生信息\n");printf("-------------------------------------------------------------------------\n");printf("--------------------------------作者: wink-------------------------------\n");printf("请选择(0-11):>");scanf("%d", &i);switch (i){case 1:InputStudent();break;case 2:ModifyStudent();break;case 3:DeleteStudent();break;case 4:InsertStudent();break;case 5:display();break;case 6:search();break;case 7:SortStudent();break;case 8:SaveStudent();break;case 9:LoadInformation();break;case 10:SearchLow();break;case 11:SearchHigh();break;case 0:printf("Thanks for using, See you again !");exit(0);default:;}}return 0;}