学生管理系统c语言主程序_第1页
学生管理系统c语言主程序_第2页
学生管理系统c语言主程序_第3页
学生管理系统c语言主程序_第4页
学生管理系统c语言主程序_第5页
已阅读5页,还剩3页未读, 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、#include<stdio.h>#include<stdlib.h>#include<string.h>#define k1 0int n;struct STUDENTchar name20; long xuehao; int chengji4;stu30;void f1();void f2();int f3();void f4();void f5();int f6();int f7(struct STUDENT stu,int *n);void f8();int main()int jianyan=1;int p;printf(" 欢迎您使用学

2、生成绩管理系统V3.0 n");printf(" (设计者:思源三班索光霁)n");F1:printf("功能列表:n .输入学生成绩n .显示学生成绩n .排序统计成绩n .查找学生成绩n .增加学生成绩");printf("n .删除学生成绩n .从文件导入学生成绩n .将学生成绩导出至文件n .退出系统(不保存)n");printf("请输入您的选择的功能(1-9):n");int bianhao;first:scanf("%d",&bianhao);switch(bia

3、nhao) case 1: ff1:f1();jianyan=0;printf("如果需要继续服务请按0,按其他数字则返回主菜单n"); scanf("%d",&p);if(p=0) goto ff1;else goto F1;break;case 2:if(jianyan) printf("请输入或导入学生成绩后再进行操作!n"); goto F1;ff2:f2(); printf("如果需要继续服务请按0,按其他数字则返回主菜单n"); scanf("%d",&p);if(p

4、=0) goto ff2;else goto F1;break;case 3:if(jianyan) printf("请输入或导入学生成绩后再进行操作!n"); goto F1; F4:f3(); printf("如果需要继续服务请按0,按其他数字则返回主菜单n"); scanf("%d",&p);if(p!=0)goto F1;else goto F4; break;case 4:if(jianyan) printf("请输入学生成绩或导入后再进行操作!n"); goto F1;ff4:f4();prin

5、tf("如果需要继续服务请按0,按其他数字则返回主菜单n");int p;scanf("%d",&p);if(p=0) goto ff4;else goto F1;break;case 5:if(jianyan) printf("请输入或导入学生成绩后再进行操作!n"); goto F1;ff5:f5();printf("如果需要继续服务请按0,按其他数字则返回主菜单:n"); scanf("%d",&p);if(p=0) goto ff5; else goto F1;break

6、;case 6:if(jianyan) printf("请输入或导入学生成绩后再进行操作!n"); goto F1;getchar();ff6:f6();printf("如果需要继续服务请按0,按其他数字则返回主菜单:n"); scanf("%d",&p);if(p=0) goto ff6;else goto F1;break;case 7:ff7:f7(stu,&n);jianyan=0; printf("如果需要继续服务请按0,按其他数字则返回主菜单n"); scanf("%d&quo

7、t;,&p);if(p=0) goto ff7;else goto F1;case 8:if(jianyan) printf("请输入或导入学生成绩后再进行操作!n"); goto F1;ff8:f8();printf("如果需要继续服务请按0,按其他数字则返回主菜单n"); scanf("%d",&p);if(p=0) goto ff8;else goto F1;break;case 9:printf("谢谢使用!如有意见或建议请联系我n");break;default: printf("

8、;你的输入有误!请重新输入:n");goto first;return 0;void f1() int i;printf("请输入学生总人数:n");scanf("%d",&n);while(n<0)printf("您的输入有误,请重新输入:");scanf("%d",&n);printf("请分别输入每个人的姓名 学号 各科分数(数学 英语 物理 体育):(每人信息录入后请用回车分隔)n");printf("姓名 学号 数学 英语 物理 体育n&quo

9、t;);for(i=0;i<n;i+) scanf("%s %d %d %d %d %d",&,&stui.xuehao,&stui.chengjik1,&stui.chengjik1+1,&stui.chengjik1+2,&stui.chengjik1+3);void f2()int i;printf("学生成绩如下:n姓名 学号 数学 英语 物理 体育n");for(i=0;i<n;i+)printf("%s %d %d %d %d %dn",stui

10、.name,stui.xuehao,stui.chengjik1,stui.chengjik1+1,stui.chengjik1+2,stui.chengjik1+3);int f3()int k,i,j,y; printf("请选择要排序的学科(数学请按“0”,英语请按“1”,物理请按“2”,体育请按“3”)n"); int m; scanf("%d",&m);printf("学生成绩如下:n 姓名 学号 数学 英语 物理 体育n");printf("");for(i=0;i<n;i+) k=i;f

11、or(j=i+1;j<n;j+)if(stuj.chengjim>stuk.chengjim) k=j;int t;for(y=0;y<4;y+)t=stui.chengjiy;stui.chengjiy=stuk.chengjiy;stuk.chengjiy=t;char *p=(char *)malloc(sizeof();strcpy(p,);strcpy(,);strcpy(,p);int q;q=stui.xuehao;stui.xuehao=stuk.xuehao;stuk.

12、xuehao=q;printf("第%d名:%s-%d %d %d %d %dn",i+1,,stui.xuehao,stui.chengjik1,stui.chengjik1+1,stui.chengjik1+2,stui.chengjik1+3);free(p);return 0;void f4()fff4:printf("请输入查找方式:1.按姓名查找 2.按学号查找n");int d;scanf("%d",&d); if(d=2)long xh;printf("请输入学号:n");

13、scanf("%d",&xh); int tt; for(tt=0;tt<n;tt+) if(xh=stutt.xuehao) break; if(tt>=n)printf("未找到该生!n"); else printf("该生 %s 学号%d成绩为:n %d %d",,stutt.xuehao,stutt.chengjik1,stutt.chengjik1+1); printf(" %d %dn", stutt.chengjik1+2,stutt.chengjik1+3);

14、else if(d=1)int tt;char q20; printf("请输入要查找的学生姓名:n");getchar(); gets(q);for(tt=0;tt<n;tt+) if(strcmp(q,)=0) break; if(tt<n) printf("该生 %s 学号%d成绩为:n %d %d",,stutt.xuehao,stutt.chengjik1,stutt.chengjik1+1); printf(" %d %dn", stutt.chengjik1+2,stu

15、tt.chengjik1+3);else printf("未找到该生!n");else printf("您的输入有误!请重新输入查找方式:n");goto fff4;void f5()printf("请输入增加的学生数:n");int s,i,j;scanf("%d",&s);j=n;n=n+s;printf("请分别输入每个人的姓名 学号 各科分数(数学 英语 物理 体育):(每人信息录入后请用回车分隔)n");printf("姓名 学号 数学 英语 物理 体育n"

16、);for(i=j;i<n;i+) scanf("%s %d %d %d %d %d",,&stui.xuehao,&stui.chengjik1,&stui.chengjik1+1,&stui.chengjik1+2,&stui.chengjik1+3);printf("修改成功!n");int f6() int i; fff6:printf("请输入想要删除的学生姓名或学号(通过姓名删除请按1,通过学号删除请按2,退出修改请按3):n"); scanf("%

17、d",&i); if(i=1) char q20; printf("请输入要删除的学生姓名:n"); getchar(); gets(q);int tt; for(tt=0;tt<n;tt+) if(strcmp(q,)=0) break; if(tt>=n)printf("未找到该生!n"); else int t,y; for(y=0;y<4;y+)t=stutt.chengjiy;stutt.chengjiy=stun-1.chengjiy;stun-1.chengjiy=t; char *p

18、=(char *)malloc(sizeof(); strcpy(p,); strcpy(,); strcpy(,p); int q; q=stutt.xuehao; stutt.xuehao=stun-1.xuehao; stun-1.xuehao=q; n-;else if(i=2) printf("请输入想要删除的学生学号(每次一个)n"); long xh; scanf("%ld",&xh); int tt; for(tt=0;tt<

19、;n;tt+) if(xh=stutt.xuehao) break; if(tt>=n)printf("未找到该生!n"); else int t,y; for(y=0;y<4;y+)t=stutt.chengjiy;stutt.chengjiy=stun-1.chengjiy;stun-1.chengjiy=t; char *p=(char *)malloc(sizeof(); strcpy(p,); strcpy(,); strcpy(,p); int q; q=stutt.xuehao; stutt.xuehao=stun-1.xuehao; stun-1.xuehao=q; n-;else if (i=3) return 0; else printf("您的输入有误,请重新输入n"); goto fff6; ; int f7(struct STUDENT stu,int *n)printf("请输入要导入文件的地址!n例如: d:学生成绩统计.txtn");char ppt30;getchar();ge

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论