1、#include#define M 30 /班级总人数,暂定30,可修改#define N 3 /课程成绩门数,暂定3,可修改 int inputstu(struct student stu, int m, int n);void prinstu(struct student stu, int m, int n);int sortsno(struct student stu, int m);int sortage(struct student stu, int m);int sortmark(struct student stu,int sm, int m, int n);void prins
2、ort(struct student stu, int m, int n);int writefile(struct student stu, FILE *fp, int m, int n);int readfile(struct student stu, FILE *fp, int m, int n);int fprinword(struct student stu, FILE *fp, int m, int n);int fprinexcel(struct student stu, FILE *fp, int m, int n);int seachsno(struct student st
3、u,long sno, int m,int n);int seachsname(struct student stu,char sname, int m, int n);int desno(struct student stu, long sno, int m);int desname(struct student stu, char sname, int m);int cutin(struct student stu, int m, int n); struct student int turn; long sno; char sname20; char sgrade10; char sbi
4、rth10; int smarkN; void main() int i = 0; int con1 = 0; int con2 = 0; FILE *fp = NULL; struct student stuM; for (i = 0; i M; i+) stui.turn = -1; do printf(nn*n); n * 学生信息管理系统 *nn * 请按提示输入相应命令: *nn 1 键盘输入所有学生的基本信息n 2 屏幕输出所有学生的基本信息n 3 子菜单:按一定顺序对学生进行排序n 4 按顺序屏幕输出学生信息n 5 保存学生信息(二进制文件)n 6 从上次保存的二进制文件中读取学
5、生信息n 7 子菜单:将学生信息保存为文本文档(人工阅读)n 8 子菜单:对单个学生的插入删除查询修改n -1 退出系统n scanf(%d, &con1); switch (con1) case 1: printf(n* 注意! *n 继续进行输入会覆盖原数据!n 第一次使用本软件或需重新写信息请继续:n 1 继续n -1 返回n scanf(con2); if (con2 = 1) inputstu(stu, M, N); break; case 2:prinstu(stu, M, N); break; case 3: do printf(n*n 1 按学号顺序进行排序n 2 按年龄从小到
6、大排序n 3 按总成绩由高到低排序n -1 返回上一级菜单n scanf( switch (con2) case 1: sortsno(stu, M); con2 = 0; break; case 2: /sortage(stu, M); case 3: int smM; sortmark(stu, sm, M, N); case -1:break; default: printf(二级命令输入错误,请重试! fflush(stdin); while (con2 != -1); case 4:prinsort(stu, M, N); case 5:writefile(stu, fp, M, N
7、); case 6:readfile(stu, fp, M, N); case 7:n*n 1 将学生信息输出为txt文档,路径:F:stustudent.txtn 2 将学生信息输出为word文档, 路径:stustudent.doc n 3 将学生信息输出为excel文档, 路径:stustudent.xls n switch (con2) case 1: break; case 2: fprinword(stu, fp, M, N); case 3: fprinexcel(stu, fp, M, N); break; case 8: don*nn 1 按学号查询单个学生n 2 按姓名查询
8、单个学生n 3 按学号删除单个学生n 4 按姓名删除单个学生n 5 插入单个学生信息n-1 返回主菜单n请输入单个学号: scanf(%10ldsno); seachsno(stu, sno, M, N); 请输入单个学生姓名:%20s,sname); seachsname(stu, sname, M, N);,& desno(stu, sno, M); case 4:%s, sname); desname(stu, sname, M); case 5: cutin(stu, M, N);二级指令错误,请重新输入! case -1:printf(感谢使用本系统! default:一级命令输入错误,请重试 fflush(stdin); while (con1 !/输入学生的基本信息int inputstu(struct student stu,int m,int n) int j = 0;
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1