


下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、C语言编写的简单学生成绩管理系统C语言编写的简单学生成绩管理系统#include"stdio.h"#include"stddef.h"#include"stdlib.h"#include"conio.h"/*屏幕操作函数*/#include"string.h"#defineMAX10typedefstructstudentcharnameMAX;charnumMAX;charsexMAX;intage;intchinese;intmathematic;intenglish;floataver;s
2、tructstudent*next;stu;stu*head;voidprint()/*输出菜单*/textcolor(RED);/*设置文本显示颜色为红色*/textbackground(GREEN);/*设置背景颜色为绿色*/window(1,1,80,10);/*制作显示菜单的窗口*/clrscr();printf("n");printf("*welcometousestudentmanage*5)printf("*MENU*5)printf("*<1>EnterRecord");/*录入信息*/printf(&qu
3、ot;<2>Statistics*n");/*显示成绩*/printf("*<3>Quest");/*查询*/printf("<4>Updata*n");/*修改*/printf("*<5>Save");/*保存到磁盘*/printf("<6>Display*n");/*统计成绩*/printf("*<7>Fresh");/*刷新*/printf("<8>Quit*n");/*退出系
4、统*/printf("$Maker:zhangwantongClass:045Date:2007.01.12$n");printf("n");voidcin(stu*p1)/*录入学生信息*/printf("Entername:n");scanf("%s",p1->name);printf("Enternum:n");scanf("%s",p1->num);printf("Entersex:n");scanf("%s",&a
5、mp;p1->sex);printf("Enterage:n");scanf("%d”,&p1->age);printf("Enterscore:n");printf("Enterchinese:n");scanf("%d",&p1->chinese);printf("Entermath:n");scanf("%d",&p1->mathematic);printf("EnterEnglish:n")
6、;scanf("%d”,&p1->english);p1->aver=(p1->chinese+p1->mathematic+p1->english)/3.0;/*平均分*/voidcindata()/*是否继续录入*/stu*p1,*p2;inti=1;charch;head=(stu*)malloc(sizeof(stu);p1=head;/*头指针*/while(i)cin(p1);printf("DoyouWanttoContinue?yesorno:");ch=getchar();ch=getchar();if(ch
7、='n'|ch='N')(i=0;p1->next=NULL;)else(p2=p1;p1=(stu*)malloc(sizeof(stu);p2->next=p1;)voidlookdata(stu*p1)/*输出所有信息*/(printf("n");while(p1!=NULL)(printf("Num:%s",p1->num);printf("Name:%s",p1->name);printf("Sex:%s",p1->sex);printf(&q
8、uot;Age:%d",p1->age);/*printf("n");*/printf("Chinese:%d",p1->chinese);printf("Math:%d",p1->mathematic);printf("English:%d",p1->english);printf("Average:%fn”,p1->aver);printf("n");p1=p1->next;)printf("n");)/*已经完成的
9、任务:1.录入保存磁盘2.按姓名学号查询3.输出成绩表4.修改处理5.统计学生成绩*/voidfind1(stu*p2)/*按姓名查找信息*/(charname20;intb=0;printf("Enterthenameofthestudentyouwanttofind:");scanf("%s",name);while(p2!=NULL)if(strcmp(name,p2->name)=0)printf("Thedatayouwanthasbefoundn");printf("n");printf(&quo
10、t;Num:%st",p2->num);printf("Name:%st",p2->name);printf("sex:%st",p2->sex);printf("age:%dt",p2->age);printf("n");printf("Chinese:%dt",p2->chinese);printf("Math:%dt",p2->mathematic);printf("English:%dt",p2->
11、;english);printf("Average:%fn",p2->aver);printf("*n");b=1;p2=p2->next;if(b=1)printf("Findonen");elseprintf("Notfindn");voidfind2(stu*p2)/*按学号查找信息*/charnumMAX;intb=0;printf("Enterthenumofthestudentyouwanttofind:");scanf("%s",&num);
12、(if(strcmp(num,p2->num)=0)(printf("Thedatayouwanthasbefoundn");printf("n");printf("Num:%st",p2->num);printf("Name:%st",p2->name);printf("Sex:%st",p2->sex);printf("Age:%dt",p2->age);printf("n");printf("Chinese:%
13、dt",p2->chinese);printf("Math:%dt",p2->mathematic);printf("English:%dt”,p2->english);printf("Average:%fn",p2->aver);printf("*n");b=1;p2=p2->next;if(b=1)printf("Findonen");elseprintf("Notfindn");voidfind()/*查询记录*/(inti;printf(
14、"<1>Findwithname<2>Findwithnum<3>Returnn");printf("PleaseEnteryourchoice:");scanf("%d”,&i);switch(i)(case1:find1(head);break;case2:find2(head);break;case3:return;)voidupdate1(stu*p2)/*按姓名修改*/(charname10;intb=0;printf("EnterTheName:");scanf(&qu
15、ot;%s”,name);while(p2!=NULL)(if(strcmp(name,p2->name)=0)(printf("Findyoudata!n");printf("Enterthenewname:");scanf("%s",p2->name);printf("Enterthenum:");scanf("%s",p2->num);printf("Enterthesex:");scanf("%s”,p2->sex);printf(&
16、quot;Entertheage:");scanf("%d”,&p2->age);printf("Enterthechinesescore:");scanf("%d",&p2->chinese);printf("Enterthemathscore:");scanf("%d",&p2->mathematic);printf("Entertheenglishscore:");scanf("%d",&p2->
17、;english);p2->aver=p2->chinese+p2->mathematic+p2->english;printf("Success!n");b=1;)p2=p2->next;)if(b=0)printf("SorrynotFinddata!n");elseprintf("Finish!n");)voidupdate2(stu*p2)/*按学号修改*/charnumMAX;intb=0;printf("EnterTheNum:");scanf("%s"
18、,&num);while(p2!=NULL)if(strcmp(num,p2->num)=0)printf("Findyoudata!n");printf("Enterthenewname:");scanf("%s",p2->name);printf("Enterthenum:");scanf("%s",p2->num);printf("Enterthesex:");scanf("%s",p2->sex);printf(&q
19、uot;Entertheage:");scanf("%d",&p2->age);printf("Enterthechinesescore:");scanf("%d",&p2->chinese);printf("Enterthemathscore:");scanf("%d",&p2->mathematic);printf("Entertheenglishscore:");scanf("%d",&p2
20、->english);p2->aver=(p2->chinese+p2->mathematic+p2->english)/3.0;printf("Success!n");b=1;)p2=p2->next;)if(b=0)printf("SorrynotFinddata!n");elseprintf("Finish!n");)voidupdate()/*修改记录*/inti;printf("<1>Updatawithname<2>Updatawithnum<3&
21、gt;Returnn");printf("PleaseEnteryourchoice:");scanf("%d”,&i);switch(i)case1:update1(head);break;case2:update2(head);break;case3:return;)voidsaved(stu*p2)/*保存到磁盘student.dat文件中*/FILE*fp;charfile16="c:student.dat"charfile1="num-name-sex-age-chinese-math-english-av
22、ern"if(fp=fopen(file,"wt")=NULL)printf("nCannotopenthefile<student>!n");return;)fprintf(fp,"%s",file1);(fprintf(fp,"%s-",p2->num);fprintf(fp,"%s-",p2->name);fprintf(fp,"%s-",p2->sex);fprintf(fp,"%d-",p2->age
23、);fprintf(fp,"%d-",p2->chinese);fprintf(fp,"%d-",p2->mathematic);fprintf(fp,”%d-",p2->english);fprintf(fp,"%fn",p2->aver);p2=p2->next;fclose(fp);printf("Savedsuccessed!");voidstatistics(stu*p2)/*统计学生成绩*/(FILE*fp,*fp1;charfile16="c:stuf
24、ile.dat",file116="c:stugood.dat"if(fp=fopen(file,"wt")=NULL)(printf("nCannotopenthefile<stufile>!n");return;if(fp1=fopen(file1,"wt")=NULL)(printf("nCannotopenthefile<stugood>!n");return;while(p2!=NULL)(if(p2->chinese<60)|(p2-&g
25、t;english<60)|(p2->mathematic<60)(fprintf(fp,"%s-",p2->num);fprintf(fp,"%s-",p2->name);fprintf(fp,"%s-",p2->sex);fprintf(fp,"%d-",p2->age);fprintf(fp,"%d-",p2->chinese);fprintf(fp,"%d-",p2->mathematic);fprintf(fp,
26、"%d-",p2->english);fprintf(fp,"%fn",p2->aver);p2=p2->next;)elseif(p2->chinese>=90)&&(p2->english>=90)&&(p2->mathematic>=90)(fprintf(fp1,"%s-”,p2->num);fprintf(fp1,"%s-”,p2->name);fprintf(fp1,"%s-”,p2->sex);fprintf
27、(fp1,"%d-”,p2->age);fprintf(fp1,"%d-”,p2->chinese);fprintf(fp1,"%d-”,p2->mathematic);fprintf(fp1,"%d-”,p2->english);fprintf(fp1,"%fn”,p2->aver);p2=p2->next;)elsep2=p2->next;)fclose(fp);fclose(fp1);printf("Savedsuccessed!");)voidprint1()system(&
28、quot;cls");/*清除整个屏幕*/voiddisplay2()/*显示不及格记录*/FILE*fp;if(fp=fopen("c:STUFILE.DAT”,"r")=NULL)printf("Cannotopenthefile!");return;while(!feof(fp)putchar(fgetc(fp);printf("bSuccess!n");voiddisplay3()/*显示90分以上同学的记录*/(FILE*fp;if(fp=fopen("c:STUGOOD.DAT”,"
29、r")=NULL)(printf("Cannotopenthefile!");return;while(!feof(fp)(putchar(fgetc(fp);printf("bSuccess!n");voiddisplay()/*显示记录*/(inti;printf("<1>DisplayAll<2>DisplayGood<3>DisplayFlunkn");printf("PlasceEnteryourchoice:");scanf("%d",&
30、amp;i);switch(i)(case1:lookdata(head);break;case2:display3();break;case3:display2();break;voidinterface()/*启动界面*/(clrscr();window(20,5,60,15);textattr(BLUE+(LIGHTGRAY<<4);clrscr();cputs("nnWelcometousestudentmanagesystem!");cputs("Maker:zhangwantong");cputs("Class:04-5");cputs("Date:2007.01.13");cputs("Edit:V1.0&qu
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 店供货合同2篇
- 贸易合同范本计划共用电责任合同3篇
- 施工现场施工安全风险评估方案
- 小学交通与停车管理方案
- 2025年晋江市晋兴职业中专学校秋季编外合同教师应聘意向摸底考试参考试题及答案解析
- 铅酸蓄电池安装维护保养合同管理范文
- 2025年8月广东广州市天河区枫叶幼儿园编外教辅人员招聘1人考试参考试题及答案解析
- 2025浙江温州瑞安市中小学招募银龄教师备考练习题库及答案解析
- 城乡供水工程施工质量控制方案
- 2025云南昆明市晋宁区夕阳彝族乡卫生院招聘编外工作人员1人备考练习试题及答案解析
- 国庆节英语介绍模板
- 《油气管道无人机智能巡检系统技术管理规范》
- 巡察工作基本流程课件
- 游艇火灾安全知识培训课件
- (2025年标准)学生玩耍纠纷协议书
- GB 46030-2025建筑用安全玻璃安全技术要求
- 2025年新《中华人民共和国安全生产法》知识竞赛测试题库含答案
- 《机械制图(多学时)》中职全套教学课件
- 新教科版小学1-6年级科学需做实验目录
- 部编教材九年级历史(上)全册教案
- 医院输血科技术人员绩效考核指标
评论
0/150
提交评论