ImageVerifierCode 换一换
格式:DOCX , 页数:16 ,大小:18.52KB ,
资源ID:6183177      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/6183177.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(学生成绩管理.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

学生成绩管理.docx

1、学生成绩管理学生成绩管理指导教师 李琳晧 实验时间: 2011 年 12月 1日学院 生物信息学院 专业 生物技术 实验室 S302 班级 0621001 学号 2010212471 姓名 李言 班级 0621001 学号 2010212481 姓名 谢保朋 实验题目:学生成绩管理(限最多2人完成)1.主要功能:(1)能按学期、按班级完成对学生成绩的录入、修改(2)能按班级统计学生的成绩,求学生的总分及平均分,并能根据学生的平均成绩进行排序(3)能查询学生成绩,不及格科目及学生名单(4) 能按班级输出学生的成绩单(5) 系统以菜单方式工作实验目的: 1、 熟悉结构体、链表的使用2、 熟悉指向函

2、数的指针、以及嵌套调用3、 学会规范、美观化设计程序实验要求:1.系统以菜单方式工作2.学生信息录入功能3.输出所有学生信息4.按班级输出学生信息5.对学生信息进行修改、删除6、添加学生信息7、对学生成绩进行排名8、查询不及格学生的名单和科目9、更改DOS界面的前景和背景颜色10、每次重新输入都进行一次刷屏实验主要步骤:1.定义结构体;2.建立链表存储学生信息;3.设计菜单,在主函数中实现各个功能函数;4.调试程序,找出问题,并且优化程序。代码如下:#include#include#includestruct stu int classnumber; char name20; int scor

3、e3; int sum; float average; struct stu *next;typedef struct stu STU;STU *head=NULL;char menu();void Applynode();void Addnode();void Total(STU *p);void Failpass();void studentlist();void classlist();void change();void delect();void Sort();void SortScore(int (*compare)(int a, int b);/函数功能:输出系统的主菜单,选择相

4、应的功能后链接到其他函数实现对应的功能char menu(void) char ch; printf(tt*n); printf(ttMENU:n); printf(tt1.输入学生成绩n); printf(tt2.输出所有学生成绩单n); printf(tt3.按班级输出成绩单n); printf(tt4.不及格科目及学生名单n); printf(tt5.增加一个学生信息n); printf(tt6.删除一个学生信息n); printf(tt7.修改一个学生信息n); printf(tt8.按总分实现排名n); printf(tt9.退出n); printf(tt*n); printf(nn

5、ttPlease enter your choice:); fflush(stdin); ch=getchar(); getchar(); return(ch);/创建链表,输入学生的成绩void Applynode() char c = y; while(c=Y|c=y) Addnode();/为新的数据申请一个节点 printf(Do you want to input another data?(Y/N):); scanf(%c,&c);/输入Y或者y则继续申请节点空间 system(cls); fflush(stdin);/向链表添加尾节点void Addnode() STU *p=N

6、ULL; STU *pr=head; p=(STU *)malloc(sizeof(STU); if(p=NULL) printf(File to apply the noden); exit(0); if(head=NULL) head=p; /如果头指针为空,将p置为首节点 else while(pr-next != NULL) pr=pr-next; pr-next=p; printf(Input the data.n); printf(Input the students namen); scanf(%s,p-name); printf(Input the students class

7、n); scanf(%d,&p-classnumber); printf(Input the students scoren); printf(Please input the score of Chinese:); scanf(%d,p-score+0); printf(Please input the score of English:); scanf(%d,p-score+1); printf(Please input the score of Math:); scanf(%d,p-score+2); Total(p); p-next=NULL; fflush(stdin);/计算每个学

8、生成绩的总分和平均分void Total(STU *p) int i; p-sum=0; for(i=0;isum+=p-scorei; p-average=(float)p-sum/3;/删除一个学生信息void delect() STU *p=head; STU *front,*current; char Name20; printf(Please input the students name:); scanf(%s,Name); if(p=NULL) printf(This is an empty list!n); else if(strcmp(head-name,Name)=0)/判

9、定删除对象是否为表头 front=head; head=head-next; free(front); else front=head; current=head-next; while(current!=NULL&strcmp(current-name,Name)!=0) front=current; current=current-next; if(current!=NULL) front-next=current-next; free(current); else printf(Cant find the student!n); /修改一个学生的信息void change() STU *

10、p=head; char Name20; printf(Please input the students name:); scanf(%s,Name); while(p!=NULL&strcmp(p-name,Name)!=0) p=p-next; if(p!=NULL) printf(input classnumber:); scanf(%d,&p-classnumber); printf(input the score:); printf(Input the score of Chinese:); scanf(%d,p-score+0); printf(Input the score o

11、f English:); scanf(%d,p-score+1); printf(Input the score of Math:); scanf(%d,p-score+2); else printf(The name dont exist!n);/输出不及格科目及学生名单void Failpass() STU *p=head; int i=0,j=0,k=0; char str100=0,s4=*; strcat(str,Classnumber Name Chinese English Math); if(p=NULL) printf(This is an empty list!n); el

12、se while(p) for(i=0,j=0;iscoreinext; p=head; if(k=0)/k值为0,则没有挂科人数,否则打印表头,输出挂科名单 printf(nttCongratuation!All pass the exam!n); else printf(%sn,str); while(p) for(i=0,j=0;iscoreiclassnumber,p-name); for(i=0;iscoreiscorei); else printf(%7s,s); printf(n); p=p-next; /输出所有学生成绩名单void studentlist() STU *p=h

13、ead; char str100=0; strcat(str,classnumber name ); strcat(str,Chinese English Math ); strcat(str,Sum Average); if(p=NULL) printf(Its an empty list!); else printf(%sn,str); while(p!=NULL) printf(%3d t%10s,p-classnumber,p-name); printf(%8d%8d%8d,p-score0,p-score1,p-score2); printf(%6d %6.2f,p-sum,p-av

14、erage); printf(n); p=p-next; /按照班级输出成绩单void classlist() STU *p=head; int num,i=0; char str100=0; strcat(str,name ); strcat(str,Chinese English Math ); strcat(str,sum Average); printf(Please input the class number you want to search:); scanf(%d,&num); if(head=NULL) printf(This is an empty list!); els

15、e while(p!=NULL) if(p-classnumber=num) i+;/用来标记,确定学生链表中是否存在你想要查找的班级 p=p-next; p=head; if(i!=0)/若为0,则你想查找的班级不存在 printf(%sn,str); while(p!=NULL) if(p-classnumber=num) printf(%s,p-name); printf(%8d%8d%8d%5d,p-score0,p-score1,p-score2,p-sum); printf(%7.2fn,p-average); p=p-next; else printf(Can not find

16、the score of Class %dn,num); /决定数据是否按升序排序,ab为真,则按升序排序int Ascending(int a, int b) return a b为真,则按降序排序 int Descending(int a, int b) return a b;/交换两个整型数void IntSwap(int *pt1, int *pt2) int temp; temp = *pt1; *pt1 = *pt2; *pt2 = temp;/*交换两个实型数*/void FloatSwap(float *pt1, float *pt2) float temp; temp = *

17、pt1; *pt1 = *pt2; *pt2 = temp;/*交换两个字符串*/void CharSwap(char *pt1, char *pt2) char temp15; strcpy(temp, pt1); strcpy(pt1, pt2); strcpy(pt2, temp);/ 用交换法按总成绩由高到低排序 void SortScore(int (*compare)(int a, int b) STU *pt; int flag = 0, i; do flag = 0 ; pt = head; if(head=NULL) printf(This is an empty list!

18、n); else while (pt-next != NULL) if (*compare)(pt-next-sum, pt-sum) IntSwap(&pt-classnumber, &pt-next-classnumber); CharSwap(pt-name, pt-next-name); for (i=0; iscorei, &pt-next-scorei); IntSwap(&pt-sum, &pt-next-sum); FloatSwap(&pt-average, &pt-next-average); flag = 1; pt = pt-next; puts(after Sorte

19、d:n); pt=head; studentlist(); while(flag);/学生成绩排序void Sort() char choice; printf(please input your choice:1-Ascending,2-Descending); choice=getchar(); getchar(); switch(choice) case 1:SortScore(Ascending); break; default:SortScore(Descending); break; void main() STU *p=NULL; char ch; system(COLOR 5B

20、); while(1) ch = menu(); switch(ch) case 1: system(cls); Applynode();/成绩输入模块 break; case 2: system(cls); studentlist();/查询所有学生成绩单 system(pause); system(cls); break; case 3: system(cls); classlist();/按班级查询学生成绩单 system(pause); system(cls); break; case 4: system(cls); Failpass();/输出不及格科目及学生名单 system(pa

21、use); system(cls); break; case 5: system(cls); Addnode();/增加输入一个学生信息 system(pause); system(cls); break; case 6: system(cls); delect();/删除一个学生信息 system(pause); system(cls); break; case 7: system(cls); change();/修改一个学生信息 system(pause); system(cls); break; case 8: system(cls); Sort();/排序 system(pause); system(cls); break; case 9: exit(0);/退出 break; default: system(cls); printf(Error!Please input your choice again!n); system(pause); system(cls); break; 心得体会:1. 哪些地方该加“”,自己必须要细心,及时打上。不然面对庞大的代码要查找起来比较难;2. 程序要规范化,让操作人员看起来比较美观3. 指向函数的指针用起来比较生疏,还要多熟悉

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1