课程设计-C语言可视化程序学生成绩管理系统_第1页
课程设计-C语言可视化程序学生成绩管理系统_第2页
课程设计-C语言可视化程序学生成绩管理系统_第3页
课程设计-C语言可视化程序学生成绩管理系统_第4页
课程设计-C语言可视化程序学生成绩管理系统_第5页
已阅读5页,还剩32页未读 继续免费阅读

下载本文档

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

文档简介

1、.中南大学机电工程工程学院 机械0805班C语言可视化程序设计报告 行政班级 机械0805 姓名 魏永涛 学号 0806080524 指导老师 夏建芳 课题名称 学生成绩管理系统 C可视化程序设计报告一.设计题目学生成绩管理系统二、课题的任务:1、 所有记录保存在一个数据文件中;2、 具备记录添加功能;3、 查询功能(如按学号查询成绩等);4、 计算统计功能(如统计某门课程的平均程序);5、 排序功能(如按成绩排序);6、 统计并显示信息功能;三课程设计目的了解软件工程中的一些系统分析,模块分析,代码设计的概念,利用visual c+实现学生成绩管理系统的录入、查询、删除、统计等基本操作,掌握

2、C语言中的结构体、指针、函数(系统函数、自定义函数)、文件操作等知识。通过对系统的分析和设计,进一步巩固C语言的学习,以提高对开发环境。四、成员承担的任务:(组长)魏永涛:完成下面子程序的编写:a:主函数的编译b:定位指针的Locate()函数的编译,与调试。c:主菜单函数的编译,及其它外部函数的编译,与调试。 d: 任务分配,规定变量符号,及变量的初始化。 e:程序的组装及调试。王栋 :完成下面子程序的编写: a:统计数据函数的编译。 b::查找学生记录函数的编译。 c:增加学生记录的函数的编译。 王义 : 完成下面子程序的编写:a:删除函数的编译b:修改函数的编译c:排序函数的编译巫培宇

3、:完成下面子程序的编写:a:显示函数的编译。b:欢迎界面的制作。c:保存函数的编译五、程序流程图1.系统总体结构图保存学生资料排序学生资料统计学生资料件显示学生资料录修改学生资料录查询学生资料录删除学生资料录创建文件输入学生资料主程序获取帮组信息退出管理系统2.main()函数流程图100I=(Node*)malloc(sizeof(Node)I->next=NULL;r=I;fp=fopen(“C:student”,”rb”)fp=NULL无文件,创建?fp=fopen(“C:student”,”rb”)Exitmain()开始导入文件!feof(fp)p=(Node*)malloc(

4、sizef(Node)fread(p,sizeof(Node),1,fp)P->next=NULL;r->next=p;R=p;count+fclose(fp)menu()1234576980非0YN假真假真3.Add函数流程图1入口r->next不为空指针后移到表尾?1=0?输出提示输入numS指针为空?s->data.num=num相关输出指针后移到表尾申请空间Anum=0NOYESNONOYESYESYESYESNOYESNOYESNOYESNO输出提示语输入对应信息计算总分和平均分指针移到表尾结束Strcpy(p->data.num,num)A4.Del函

5、数流程图NoYes2入口输入要删除的学号有此学号?结束学生不存在输出找到的学生信息删除该学生信息5.Qur函数流程图3入口!l->next输出提示语输入selsel=11输出提示语输入学号定为结点指针为空输出成绩sel=22输出提示语输入姓名定为结点指针为空输出成绩输出提示语BB结束NOYESYESNOYESNONOYESYESNO6.Modify函数流程图NoYes4入口输入要修改的学号有此学号?结束输出学生不存在输出找到的学生信息输入新的学生相关信息7.Disp函数流程图结束!p没有可供现实的数据显示已有信息P调用printc函数p=p->next打出星号假真0非058.Ton

6、gji函数流程图6入口!l pm=pe=pc=pt=pa=rr!=NULL找到各量最大值指针后移到表尾?“输出各统计结果结束输出提示语YESNONOYES9.Sort函数流程图7入 口分数比较排序点值小排序点值大后移排在首位插入中间位置到表尾?记录名次结 束NoYesNoYes10.Save函数流程图8fp=fopen(“c:student”,”rb”)fp=NULL文件打开错误退出p=I->nextpFwrite(p,sizeof(Node),1,fp)=1p=p->nextcount+flog=0flog保存成功shoudsave=0fclose(fp)假真0非0真假0非0返回

7、menu11.locate函数流程图10Strcmp(nameornum,num)=0r=I>nextr!=NULL Strcmp(r->data.num,findmess)=0return rr=r>nextStrcmp(nameornum,name)=0r=I>nextr!=NULL Strcmp(r->data.num,findmess)=0return rr=r>next返回一个地址或0假真0非0假真假真0非0假真六.系统实际运行效果1. 欢迎界面2. 主菜单3. 输入学生资料4.删除学生资料8.保存4. 查询5.修改6.显示7.统计8.排序9.排序

8、结果10.帮助11.退出七.系统源代码#include "stdio.h" #include "stdlib.h" #include "string.h" int shoudsave=0; /定义一个全局变量 struct student char num11;/学号 char name20;/姓名 char sex4; /性别 int cgrade; /c语言成绩 int mgrade; /数学成绩 int egrade; /英语成绩 int totle; /总分 int ave; /平均分 char neartime10;/最近更

9、新时间 ; typedef struct node /声明新的结构体类型Node struct student data; struct node *next; Node,*Link; void welcome()/欢迎界面 printf(" *n"); printf(" *欢 迎 使 用*n"); printf(" *中南大学学生成绩管理系统 *n"); printf(" *n"); printf(" 本系统由中南大学机械0805班梦幻小组nttt倾情奉献n"); printf("n

10、"); printf(" 愿我们的努力n"); printf(" 能为您的学习工作带来方便n"); printf(" 您的支持将是我们不断创新的动力n"); printf(" 祝您使用愉快!ntt如有任何疑问联系我们ntt QQ:453275642nttTel"); void menu() /主菜单 printf("t*n"); printf("t* MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM

11、MMMMMMM *n"); printf("t* MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM *n"); printf("t* MMM 1<输入学生资料> 2<删除学生资料> MMM *n"); printf("t* MMM 3<查询学生资料> 4<修改学生资料> MMM *n"); printf("t* MMM 5<显示学生资料> 6<统计学生成绩> MMM *n&quo

12、t;); printf("t* MMM 7<排序学生成绩> 8<保存学生资料> MMM *n"); printf("t* MMM 9<菜单导航> 0<退出系统> MMM *n"); printf("t* MMM MMM *n"); printf("t* MMM MMM *n"); printf("t* MMM * MMM *n"); printf("t* MMM i 欢迎使用中南大学学生成绩管理系统i MMM *n"); pri

13、ntf("t* MMM * MMM *n"); printf("t* MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM *n"); printf("t* MMM 出品人:梦幻小组 | 辅导老师:夏建芳 MMM *n"); printf("t* MMM 组长:魏永涛 | 梦幻组合 MMM *n"); printf("t* MMM 组员:王栋 王义 巫培宇| 成就梦幻品质 MMM *n"); printf("t* MMMMM

14、MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM *n"); printf("t*n"); void printstart() printf("-n"); void Wrong() printf("n对不起!你输入的信息有误!请重新输入!n"); void Nofind() printf(" _n"); printf("nt!提示:没有找到该学生!n"); printf(" _n"); printf("

15、;n"); void printc() / 本函数用于输出中文 printf(" 学号t 姓名 性别 英语 数学 C语言 总分 平均分n"); void printe(Node *p)/本函数用于输出英文 printf("%-12s%st%st%dt %dt %dt %dt %dn",p->data.num,p->,p->data.sex,p->data.egrade,p->data.mgrade,p->data.cgrade,p->data.totle,p->data.ave)

16、;/输出成绩 Node* Locate(Link l,char findmess,char nameornum) /该函数用于定位链表中符合要求的接点,并返回该指针 Node *r; if(strcmp(nameornum,"num")=0) /按学号查询 r=l->next; while(r!=NULL) if(strcmp(r->data.num,findmess)=0)/将输入学号与已有学号对比 return r; /返回地址 r=r->next; else if(strcmp(nameornum,"name")=0) /按姓名查

17、询将输入姓名与已有姓名对比 r=l->next; while(r!=NULL) if(strcmp(r->,findmess)=0) return r; /返回地址 r=r->next; return 0; void Add(Link l) /增加学生 Node *p,*r,*s; /定义Node型指针 char num11; r=l; s=l->next; while(r->next!=NULL) r=r->next; /将指针置于最末尾 while(1) printf("请您输入学号(以'0'返回上一级菜单:)

18、"); scanf("%s",num); if(strcmp(num,"0")=0) break; while(s) if(strcmp(s->data.num,num)=0)/将新输入学号与已有学号对比 printf("!提示:学号为'%s'的学生已经存在,若要修改请你选择'4 修改'!n",num); printstart(); printc(); printe(s); printstart(); printf("n"); return; s=s->next

19、;/指向下一个地址 p=(Node *)malloc(sizeof(Node);/在内存中分配长度与node相同的连续空间用于存储新数据 strcpy(p->data.num,num); printf("请你输入姓名:"); scanf("%s",p->); getchar(); printf("请你输入性别:"); scanf("%s",p->data.sex); getchar(); printf("请你输入c语言成绩:"); scanf("%d

20、",&p->data.cgrade); getchar(); printf("请你输入数学成绩:"); scanf("%d",&p->data.mgrade); getchar(); printf("请你输入英语成绩:"); scanf("%d",&p->data.egrade); getchar(); p->data.totle=p->data.egrade+p->data.cgrade+p->data.mgrade; /求总分 p-&g

21、t;data.ave=p->data.totle / 3;/信息输入已经完成 p->next=NULL; r->next=p; r=p; shoudsave=1; void Qur(Link l) /查询学生 int sel; char findmess20; Node *p; if(!l->next)/当l->next=NULL时成立 printf("n*>提示:没有资料可以查询!n"); return; printf("n*>1按学号查找n*>2按姓名查找n"); scanf("%d"

22、;,&sel); if(sel=1)/学号 printf("请你输入要查找的学号:"); scanf("%s",findmess); p=Locate(l,findmess,"num"); if(p) printf("tttt查找结果n"); printstart(); printc(); printe(p); printstart(); else Nofind(); else if(sel=2) /姓名 printf("请你输入要查找的姓名:"); scanf("%s&quo

23、t;,findmess); p=Locate(l,findmess,"name"); if(p) printf("tttt查找结果n"); printstart(); printc(); printe(p); printstart(); else Nofind(); else Wrong(); void Del(Link l) /删除函数 int sel; Node *p,*r; char findmess20; if(!l->next) printf("n*>提示:没有资料可以删除!n"); return; printf

24、("n*>1按学号删除n*>2按姓名删除n"); scanf("%d",&sel); if(sel=1) printf("请你输入要删除的学号:"); scanf("%s",findmess); p=Locate(l,findmess,"num"); if(p) r=l; while(r->next!=p) r=r->next; r->next=p->next; free(p); printf("n*>提示:该学生已经成功删除!n&qu

25、ot;); printf("tttt请按任意键返回。n"); getchar(); shoudsave=1; else Nofind(); else if(sel=2) printf("请你输入要删除的姓名:"); scanf("%s",findmess); p=Locate(l,findmess,"name"); if(p) r=l; while(r->next!=p) r=r->next; r->next=p->next; free(p); printf("n*>提示:该

26、学生已经成功删除!n"); shoudsave=1; else Nofind(); else Wrong(); void Modify(Link l) /修改函数模块 Node *p; char findmess20; if(!l->next) printf("n*>提示:没有资料可以修改!n"); return; printf("请你输入要修改的学生学号:"); scanf("%s",findmess); p=Locate(l,findmess,"num"); void printstart

27、1(); if(p) printf("请你输入新学号(原来是%s):",p->data.num); scanf("%s",p->data.num); printf("请你输入新姓名(原来是%s):",p->); scanf("%s",p->); getchar(); printf("请你输入新性别(原来是%s):",p->data.sex); scanf("%s",p->data.sex); printf

28、("请你输入新的c语言成绩(原来是%d分):",p->data.cgrade); scanf("%d",&p->data.cgrade); getchar(); printf("请你输入新的数学成绩(原来是%d分):",p->data.mgrade); scanf("%d",&p->data.mgrade); getchar(); printf("请你输入新的英语成绩(原来是%d分):",p->data.egrade); scanf("%d

29、",&p->data.egrade); p->data.totle=p->data.egrade+p->data.cgrade+p->data.mgrade; p->data.ave=p->data.totle/3; printf("n*>提示:资料修改成功!n"); shoudsave=1; else Nofind(); void Disp(Link l)/显示函数模块 int count=0; Node *p; p=l->next; if(!p) printf("n*>提示:没有资料

30、可以显示!n"); return; printf("tttt显示结果n"); printstart(); printc(); printf("n"); while(p) printe(p); p=p->next; printstart(); printf("n"); void Tongji(Link l) Node *pm,*pe,*pc,*pt,*pa; /用于指向分数最高的接点 Node *r=l->next; if(!r) printf("n*>提示:没有资料可以统计!n"); r

31、eturn ; pm=pe=pc=pt=pa=r; while(r!=NULL) if(r->data.cgrade>=pc->data.cgrade) pc=r; if(r->data.mgrade>=pm->data.mgrade) pm=r; if(r->data.egrade>=pe->data.egrade) pe=r; if(r->data.totle>=pt->data.totle) pt=r; if(r->data.ave>=pa->data.ave) pa=r; r=r->next

32、; printf("-统计结果-n"); printf("*总分最高者:t%s %d分n",pt->,pt->data.totle); printf("*平均分最高者:t%s %d分n",pa->,pa->data.ave); printf("*英语最高者:t%s %d分n",pe->,pe->data.egrade); printf("*数学最高者:t%s %d分n",pm->,p

33、m->data.mgrade); printf("*c语言最高者:t%s %d分n",pc->,pc->data.cgrade); printstart(); void Sort(Link l) Link ll; Node *p,*rr,*s; ll=(Link)malloc(sizeof(Node); /用于做新的连表 ll->next=NULL; if(l->next=NULL) printf("n*>提示:没有资料可以排序!n"); return ; p=l->next; while(p)

34、 s=(Node*)malloc(sizeof(Node); /新建接点用于保存信息 s->data=p->data; s->next=NULL; rr=ll; while(rr->next!=NULL && rr->next->data.totle>=p->data.totle) rr=rr->next; if(rr->next=NULL) rr->next=s; else s->next=rr->next; rr->next=s; p=p->next; free(l); l->n

35、ext=ll->next; printf("n*>提示:排序已经完成!n"); void Save(Link l) FILE* fp; Node *p; int flag=1,count=0; fp=fopen("c:student","wb"); if(fp=NULL) printf("n*>提示:重新打开文件时发生错误!n"); exit(1); p=l->next; while(p) if(fwrite(p,sizeof(Node),1,fp)=1) p=p->next; cou

36、nt+; else flag=0; break; if(flag) printf("n*>提示:文件保存成功.(有%d条记录已经保存.)n",count); shoudsave=0; fclose(fp); void help() printf("欢迎进入中南大学学生成绩管理系统菜单导航ntt我们将竭诚为您服务n"); printf("以下是各菜单功能简介:"); printf("1.<输入>:此功能用于录入新生学号,性别,及各科成绩。n"); printf("2.<删除>:

37、用于注销离校学生资料。n"); printf("3.<查询>:此功能下设两个选项,分别用于学号查询和姓名查询。n"); printf("4.<修改>;用来改动已录入的学生信息。n"); printf("5.<显示>:用来显示所有学生信息。n"); printf("6.<统计>:选出总成绩第一,及单科第一的学生n"); printf("7.<排序>:用来对学生成绩进行排序,但不显示。n"); printf("8.<

38、;保存>:用于存储新录入的学生信息,在每次操作最后必须保存。n"); printf("如您人有疑问请联系我们"); printf("tttt请按任意键返回。n"); getchar(); void main() Link l;/链表 FILE *fp; /文件指针 int sel; char ch; char jian; int count=0; Node *p,*r; welcome(); printf("nnttttttt请按任意键继续n"); getchar(); printf("tt*");

39、 printf("tttt 学生成绩管理系统n"); printf("tt*"); l=(Node*)malloc(sizeof(Node); l->next=NULL; r=l; fp=fopen("C:student","rb"); if(fp=NULL) printf("n*>提示:文件还不存在,是否创建?(y/n)n"); scanf("%c",&jian); if(jian='y'|jian='Y') fp=fop

40、en("C:student","wb"); else exit(0); printf("n*>提示:文件已经打开,正在导入记录.n"); while(!feof(fp) p=(Node*)malloc(sizeof(Node); if(fread(p,sizeof(Node),1,fp) /将文件的内容放入接点中 p->next=NULL; r->next=p; r=p; /将该接点挂入连中 count+; fclose(fp); /关闭文件 printf("n*>提示:记录导入完毕,共导入%d条记录

41、.n",count); while(1) menu(); printf("请你选择操作:"); scanf("%d",&sel); if(sel=0) if(shoudsave=1) getchar(); printf("n*>提示:资料已经改动,是否将改动保存到文件中(y/n)?n"); scanf("%c",&ch); if(ch='y'|ch='Y') Save(l); printf("n*>提示:你已经退出系统,再见!n&quo

42、t;); break; switch(sel) case 1:Add(l);break; /增加学生 case 2:Del(l);break;/删除学生 case 3:Qur(l);break;/查询学生 case 4:Modify(l);break;/修改学生 case 5:Disp(l);break;/显示学生 case 6:Tongji(l);break;/统计学生 case 7:Sort(l);break;/排序学生 case 8:Save(l);break;/保存学生 case 9:help();break; default: Wrong();getchar();break; / g

43、 an employment tribunal claimEmployment tribunals sort out disagreements between employers and employees.You may need to make a claim to an employment tribunal if:· you don't agree with the disciplinary action your employer has taken against you· your employer dismisses you and you thi

44、nk that you have been dismissed unfairly.For more information about dismissal and unfair dismissal, see Dismissal.You can make a claim to an employment tribunal, even if you haven't appealed against the disciplinary action your employer has taken against you. However, if you win y

45、our case, the tribunal may reduce any compensation awarded to you as a result of your failure to appeal.Remember that in most cases you must make an application to an employment tribunal within three months of the date when the event you are complaining about happened. If your application is receive

46、d after this time limit, the tribunal will not usually accept it.If you are worried about how the time limits apply to you, take advice from one of the organisations listed under Further help.Employment tribunals are less formal than some other courts, but it is still a legal process and you wi

47、ll need to give evidence under an oath or affirmation.Most people find making a claim to an employment tribunal challenging. If you are thinking about making a claim to an employment tribunal, you should get help straight away from one of the organisations listed under Further help.If you are b

48、eing represented by a solicitor at the tribunal, they may ask you to sign an agreement where you pay their fee out of your compensation if you win the case. This is known as a damages-based agreement. In England and Wales, your solicitor can't charge you more than 35% of your compensation &

49、#160;if you win the case.If you are thinking about signing up for  a damages-based agreement, you should make sure you're clear about the terms of the agreement. It might be best to get advice from an experienced adviser, for example, at a Citizens Advice Bureau.  To find your nearest

50、CAB, including those that give advice by e-mail, click on nearest CAB.For more information about making a claim to an employment tribunal, see Employment tribunals.The (lack of) air up there Watch mCayman Islands-based Webb, the head of Fifa's anti-racism taskforce, is in London for th

51、e Football Association's 150th anniversary celebrations and will attend City's Premier League match at Chelsea on Sunday."I am going to be at the match tomorrow and I have asked to meet Yaya Toure," he told BBC Sport."For me it's about how he felt and I would like to speak to him first to find out what his experience was."Uefa has opened disciplinary proceedings against CSKA for the "racist behaviour of their fans" during City's 2-1 win.Michel Platini, president of European football&#

温馨提示

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

评论

0/150

提交评论