学生成绩管理系统数据结构课程设计_第1页
学生成绩管理系统数据结构课程设计_第2页
学生成绩管理系统数据结构课程设计_第3页
学生成绩管理系统数据结构课程设计_第4页
学生成绩管理系统数据结构课程设计_第5页
免费预览已结束,剩余35页可下载查看

下载本文档

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

文档简介

1、?算法与数据结构课程设计?综合实验课程设计名称:专业:学生成绩治理系统问题的描述和分析L1问题的描述随着社会的开展和经济时代的到来,治理信息系统在各行各业都越来越重要,特别是教育事业.在经济兴旺的国家,许多教育机构如公办、私立、培训机构等,都投入了大量的资金开发MIS系统,以求在将来剧烈的竞争中立于不败之地.在我国,民办教育是新兴的一个行业,是随着改革开放和市场经济的开展根据中国特有的国情开展起来的,特别是中国民办教育促进法的出台,从一定的程度上标准和促进了中国民办教育的开展,这是一个很有开展前途的新兴产业,但是同兴旺国家相比,我国的民办教育行业的信息技术的应用程度还很低,只有在大城市中开展较

2、早、规模较大的民办院校中才使用计算机进行大规模操作,从各方面提升工作效率,取得良好的社会和经济效益,而一些新兴的、规模较小的民办机构还没有全部具备这种功能.因此可见,随着我国民办教育的迅速开展,信息技术在其上的应用会更加地广泛和深入.L2现有系统存在问题的分析有的学校根本就没有系统,还是手工操作计算机日新月异的开展,但是有的领导只见眼前利益,不关心,甚至不敢尝试新兴的事物.手工操作还十分落后,效率极低,本钱很大,以后的社会是信息的社会,信息只有快,准,精才能发挥其价值.所以机器代替人力是必然的历史开展趋势,只有领导的重视和支持才能从人工操作改为计算机的自动化系统.人工操作必将被计算机代替.有些

3、学校虽使用了计算机,甚至治理系统,但是仍然存在很多问题,问题一日不解决,效率就一日提不上去.还有,有的系统很不完善到处是漏洞,可以说是千疮百孔,这样极不完善的系统能有保证吗?所以制作一个完善的学生治理系统是必不可少的.二、数据结构的设计structperson(charname20;longnum;floatmath;floatEnglish;floatchinese;floataverage;floatsum;student;三、模块:开始学生成绩治理系统模块四、算法的设计1.在此成绩治理系统中,要求用户输入的只是有字符型和数值型数据,所以我设计了下而函数gets(numstr);stude

4、nt.English=atof(numstr);printf(nyourchinese:z,);gets(numstr);student.chinese=atof(numstr);student.sum=student.chinese+student.math+student.English;studentaverage=student.sum/3;fwrite(ftstudent,sizeof(structperson),1,fp);N+;printf(Doyoucontinueaddingotherstudents(Y/N)?n);ch=getchar();getchar();while(

5、ch二二'y'"ch二二'Y');)printf(*Showall(Y/N)?n");ch2=getchar();getchar();if(ch2=,y,ich2=,Y,)Listall();fclose(fp);return_confirm();clrscr();)字段的选择,即按学号或按姓名进行查询来处理并对输出的数据进行检验.intN=0;Enter()(FILE*fp;charch;charch2;charnumstr20;structpersonstudent2;clrscr();fp=fopen(jie.txt",&qu

6、ot;ab");if(fp=NULL)(printf(can'topenthisfile.n);printfC'waitforasecondwithpatienee.nthesystemisexiting.n);getchO;exit(0);else(doprintfC'yourname:);gets();printf(nyournum:);gets(numstr);student.num=atol(numstr);printf(nyourmath:");gets(numstr);student.math=atof(numst

7、r);printf(nyourEnglish:");2 .查询学生记录当用户执行此查询任务时,系统会提示用户进行查假设此学生记录存在,那么会打印输出此学生记录的信息.Searcho(charchoice;charchi;charch2;charch3;charch4;charname20;longnum;charnumstr20;clrscr();printf("*>kWAYSOFSEARCHING*®");printf(nn)水水n);prin2.num求水n);printf(n);printf(/zgiveyourchoic

8、e:n);choice=getchar();getchar();while(choice'2'choice<,T)(printf("Sorry,yourchoiceiswrong.npleasegiveacorrectone:n);choice=getchar();getchar();)3 .根据姓名或学号进行查找switch(choice)(caseT':doLoopl:printf(inputthenameofstudentsyouwanttosearch:nz,);gets(name);Searchi(name);printf(GOONSEARCH

9、INGBYNAEM(Y/N)?n);ch2=getchar();getchar();while(ch2=,yIch2=,;printf("Searchbyotherways(Y/N)?n");ch3=getchar();getchar();if(ch3='y'I|ch3='Y')gotoLoop2;break;case'2':doLoop2:printf("inputthenumofstudentsyouwanttosearch:n,z);gets(numstr);num=atol(numstr);Search?(n

10、um);printfCGOONSEARCHINGBYNUM(Y/N)?W);chl=getchar();getchar();while(ch1>y;ch仁二'Y');Search2(1ongnum)(FILE*fp;charch;intflag=0;intt;clrscr();fp二fopen(,zjie.txt,rb);if(fp二二NULL)(printfCean'topenthisfile.n");printf("waitforasecondwithpatienee.nthesystemisexiting.n);getch();exit(

11、O);else(flag=O;t=0;while(fread(&student,sizeof(structperson),1,fp)if(num=student.num)(printf(namettnumtchinese'tEnglish'tmathsumtaveragen/z);printf(z/%-10s%-61d%-8.2f%-8.2f%-8.2f%-8.2f%-8. 2fn,,student.num,student.chinese,student.English,student.math,student.sum,student.avera

12、ge);t=l;break;)if(t0)printf("Sorry,thestudentyouaresearchingnotexisted.n);rewind(fp);fclose(fp);)Searchi(char*name)(FILE*fp;charch;intflag=0;intt;clrscr();fp=fopen(jie.txt",rb");if(fp=NULL)(printf(cantopenthisfile.n);printf(waitforasecondwithpatienee.nthesystemisexiting.n);getch();exi

13、t(0);)else(flag=0;t=0;while(fread(ftstudent,sizeof(structperson),1,fp)if(strcmp(name,)=0)(printf(z/namettnumtchinesetEnglish,tmathsumtaveragen/z);printf(,%-10s%-61d%-8.2f%-8.2n-8.2f%-8.2f%-8.2fn,,student.num,student.chinese,student.English,student.math,student.sum,student.ave

14、rage);t=l;break;if(t=0)printf("Sorry.thestudentyouaresearchingnotexisted.n");rewind(fp);fclose(fp);)Delete()(FILE*fp;structpersonstudentl30,student230;inti;intk;intj;intflag;charchi;charname20;charch;charch2;clrscr();fp=fopen(txt,rb+);if(fp二二NULL)printf(zzcan'topenthisfile.n");pri

15、ntf(/zwaitforasecondwithpatienee.nthesystemisexiting.n);getch();exit(O);else(doi=0;j=0;flag=0;printf(z,inputthenameofstudentsyouaregoingtodelete.rT);seanf(s,name);while(fread(&student,sizeof(structperson),1,fp)=1)(if(stremp(name,)!=0)(student2j=student;j+;)else(flag=l;printfCnametttn

16、umtchinesettEnglishttmathtsumtaveragen");printf("%-10s%-61d%8.2f%8.2f%8.2f%8.2f%8.2fn,,student.num,student.chinese,student.English,student.math,student.sum,student.average);printf("Delete(Y/N)?n);chl=getchar();getchar();toupper(ch);if(ch='N')gotoLoop;)printf(j=%dn,

17、j);k二j;i=0;fclose(fp);if(flag=0)printf("Sorry,thestudentyouaresearchingnotexisted.nz/);if(flag=l)printf(Congratulation!yousucceed!n");fp=fopen(jie.txt,"wb+);if(fp-NULL)(printfCean'topenthisfile.n);printf(/zwaitforasecondwithpatienee.nthesystemisexiting.n);getch();exit(0);else(i二0;

18、dofwrite(ftstudent2Li,sizeof(structperson),1,fp);i+;while(i<k);Loop:getchar();printf("Goon(Y/N)?n");ch=getchar();getchar();while(ch二二'ych=,Y');printf("Showall(Y/N)?n");ch2=getchar();getchar();if(ch2二二'yich2='Y')(rewind(fp);printf(,znametttnumtchinesettEngli

19、shttmathtsumtaveragenz/);while(fread(ftstudent,sizeof(structperson),1,fp)(printf(,%-10s%-61d%8.2f%8.2f%8.2f%8.2f%8.2fn,z,,student.num,student.chinese,student.English,student.math,studedeleted:nz,);nt.sum,student.average);)fclose(fp);return_confirm();)4.修改学生记录在修改学生记录操作中,系统会先按输入的学号或姓名查找该记录

20、,然后提示用户修改学号或姓名之外的值,但学号或姓名不能修改.Revise()(FILE*fp;charch;charchi;longoffset=sizeof(structperson);intflag=0;charnumstr20;charname20;clrscr();fp=fopen(txt,rb+);if(fp=NULL)(printf(can'topenthisfile.n);printf(/zwaitforasecondwithpatienee.nthesystemisexiting.n");getch();exit(0);else(again:printf(na

21、meofrivesingstudent:n");gets(name);doflag=0;fread(&student,sizeof(structperson),1,fp);if(strcmp(name,)=0)(flag=l;printf(thefollowingisinformationofstudentbeingprintf(namettnumtmathtchinesetEng1ishtsumtaveragen/z);printfC%-10s%-61d%8.2f%8.2f%8.2f%8.2f%8.2fn,,student.n

22、um,student.chinese,student.English,student.math,student.sum,student.average);do(printf(/z*informationsforrevising*n);printf("=n);printf(z,#1.name2.num#n");printf('#3.math4. English#n");printf("#5. chinese6.total#n);printf(=n);printf(z/giveachoice:nz/);ch=getchar();getchar();w

23、hile(ch'6'chT')printf(/zSorry.youputiswrong.npleaseinputanotherchoice:nz/);ch=getchar();getchar();)switch(ch)(caseT':ass_revise("name");gets();break;case2':ass_reviseCnunT);gets(numstr);student.num=atol(numstr);break;case3:ass_revise(math");gets(numstr)

24、;student.math=atof(numstr);break;case4':ass_revise("English");gets(numstr);student.English=atof(numstr);break;case5':ass_revise(chinese");gets(numstr);student.chinese=atof(numstr);break;case6':ass_revise(total);gets();ass_reviseCnum");gets(numstr);student.

25、num=atol(numstr);ass_revise("math");gets(numstr);student.math=atof(numstr);ass_revise("English");gets(numstr);student.English=atof(numstr);ass_revise(zzchinese);gets(numstr);student.chinese=atof(numstr);student.sum=student.chinese+student.math+student.English;student.average=stud

26、ent.sum/3;printf(''Continuerevisingthesamestudent(Y/N)?n);chl=getchar();getchar();while(ch二二'y'ch=,F);fseek(fp,-offset,1);fwrite(&student,sizeof(structperson),1,fp);printf(thefollowingisinformationofstudenthadbeenrevised:n/z);printfCnamettnumtmathtchinesetEnglishtsumtaveragenz,);

27、printf(,%-10s%-61d%8.2f%8.2f%8.2f%8.2f%8.2fnz,,student.num,student.chinese,student.English,student.math,student.sum,student.average);printf(Congratulation!yousucceed!nz/);break;while(fread(&student,sizeof(structperson),1,fp);rewind(fp);if(flag=0)printf("Sorry,thestudentofrevingn

28、otexisted.n);printf(G0ONRevising(Y/N)?n);chl=getchar();getchar();if(chy,i|chi*Y*)gotoagain;fclose(fp);return_confirm();clrscr();)5.对学生记录进行排序Order()FILE*fp;charch;charch2;intk;floata30,b30,c30,d30;structpersonstudentl30;inti;charchi;fp=fopen(jie.txt,rb);if(fp二二NULL)(printf(cantopenthisfile.n);printf(

29、/zwaitforasecondwithpatienee.nthesystemisexiting.n);getch();exit(0);)rewind(fp);i=0;while(fread(&studentli,sizeof(structperson),1,fp)i+;k=i;do(for(i=0;i<k;i+)(ai=studentli.math;bi=studentli.English;ci=studentli.chinese;di=studentli.average;)printf(,z*WAYSOFORDER*n);iswrong.npleasegiveanotherc

30、hoice:n,?);ch二getchar();getchar();)switch(ch)(case'r:0rderl(a);break;case'2":Order1(b);break;case3:0rderl(c);break;case'4f:Order1(d);break;printf("=n);printf(,z*l.math2.English*n,z);printf(,z*3.chinese4.average*、n);printf(=n);printf("pleasegiveachoice:n);ch=getchar();getch

31、ar();while(ch<,ch>'4')(printf("Sorry,thedateyouinputwith)printf(Congratulation!yousucceed!n);printf(''Goonordering(Y/N)?nv;chl=getchar();getchar();while(ch二'y,):ch='Y');printf("Showall(Y/N)?n);ch2=getchar();getchar();if(ch2=,yIch2=,Y*)rewind(fp);printf(,zn

32、ametttnumtchinesettEnglishttmathtsumtaveragenz,);while(fread(&student,sizeof(structperson),1,fp)(printf(,%-10s%-61d%8.2f%8.2f%8.2f%8.2f%8.2fn,,student.num,student.chinese,student.English,student.math,student.sum,student.average);)fclose(fp);returneeonfirm();)Orderl(float*p)(FILE*fp;i

33、nti=0;intk;intj;structpersonstudent2;structpersonstudentl30;clrscr();fp=fopen(jie.txt",r+);if(fp=NULL)(printf(cantopenthisfile.n);printf(z/waitforasecondpatienee.nthesystemisexiting.n);getchO;exit(0);else(while(fread(&student1i,sizeof(structperson),1,fp)i+;k=i;i=0;while(i<k)(for(j=i+l;j&

34、lt;k;j+)if(pi<pj)student2=studentli;studentli=studentlj;studentlj=student2;i+;rewind(fp);for(i=0;i<k;i+)fwrite(ftstudentli,sizeof(structperson),1,fp);fclose(fp);)6.显示学生记录由于记录显示操作经常进行,所以我将这分由独立的函数来实现,减少代码的重复.Listall()(FILE*fp;charch;structpersonstudentl30;inti;intk;fp=fopen(,zjie.txt,r);if(fp二二

35、NULL)(printf(cantopenthisfile.n);)fclose(fp);returneeonfirm();printf(waitforasecondwithpatienee.nthesystemisexiting.n);getch();exit(O);else(dorewind(fp);printfCnametttnum,tchinesettEnglishttmathtsumtaveragenz,);while(fread(&student,sizeof(structperson),1,fp)(四、具体程序的实现nclude,zstdio.h#include/zstr

36、ing.h#includestdlib.h#include/zctype.structperson(charname20;longnum;floatmath;floatEnglish;floatchinese;floataverage;floatsum;student;intN=0;Enter()(FILE*fp;charch;charch2;printf(,%-10s%-61d%8.2f%8.2f%8.2f%8.2f%8.2fn,,student.num,student.chinese,student.English,student.math,student.sum,

37、student.average);printffGO0N(Y/N)?n");ch=getchar();getchar();while(ch二二,y,:ch=,Y');charnumstr20;structpersonstudent2;clrscr();fp=fopetxt",ab");if(fp二二NULL)(printfCean'topenthisfile.n");printf(,zwaitforasecondwithpatienee.nthesystemisexiting.n);getch();exit(0);elsedo(print

38、f(zzyourname:);gets();printfCnyournum:);gets(numstr);student.num=atol(numstr);printf(zznyourmath:");gets(numstr);student.math=atof(numstr);printf(nyourEnglish:);gets(numstr);student.English=atof(numstr);printfCnyourchinese:);gets(numstr);student.chinese=atof(numstr);student.sum=stud

39、ent.chinese+student.math+student.English;studentaverage=student.sum/3;fwrite(&student,sizeof(structperson),1,fp);N+;printf(Doyoucontinueaddingotherstudents(Y/N)?n);ch=getchar();getchar();while(ch='y'Ijch-Y');printf(,?Showall(Y/N)?n");ch2=getchar();getchar();if(ch2='y'I;c

40、h2='Y')Listall();fclose(fp);return_confirm();clrscr();Search()charchoice;charchi;charch2;charch3;charch4;charname20;longnum;charnumstr20;clrscr();printf("*WAYSOFSEARCHING*'n);printf("n);*n);prin2.num*n);printf("n);printf(z/giveyourchoice/n);choice=getchar();getch

41、ar();while(choice'2'I;choice,T)(printf(zzSorry.yourchoiceiswrong.npleasegiveacorrectone:n);choice=getchar();getchar();switch(choice)(caseT':doLoopl:printf(inputthenameofstudentsyouwanttosearch:n,z);gets(name);Searchi(name);printfCGOONSEARCHINGBYNAEM(Y/N)?n");ch2=getchar();getchar();

42、while(ch2='y'I|ch2='Y');printf("Searchbyotherways(Y/N)?n);ch3=getchar();getchar();if(ch3='y'ch3='Y')gotoLoop2;break;case'2:do(Loop2:printfCinputthenumofstudentsyouwanttosearch:n);gets(numstr);num=atol(numstr);Search2(num);printfCGOONSEARCHINGBYNUM(Y/N)?n"

43、;);chl=getchar();getchar();while(ch八二'y'Iichi二二'Y');Search2(1ongnum)FILE*fp;charch;intflag=0;intt;clrscr();fp=fopen(z/jie.txt","rb);if(fp二二NULL)(printf(can'topenthisfile.n,z);printf(z/waitforasecondwithpatienee.nthesystemisexiting.n);getch();exit(O);else(flag=0;t=0;whil

44、e(fread(&student,sizeof(structperson),1,fp)if(num=student.num)printfCnamettnumtchinesetEnglishtmathsumtaveragenzz);printf(zz%-10s%-61d%-8.2f%-8.2f%-8.2f%-8.2f%-8.2,student.num,student.chinese,student.English,student.math,student.sum,student.average);t=l;break;if(t=0)printf(/zSorry

45、.thestudentyouaresearchingnotexisted.nz,);rewind(fp);fclose(fp);Searchi(char*name)(FILE*fp;charch;intflag=0;intt;clrscr();fp=fopetxt","rb);if(fp=NULL)printf(cantopenthisfile.nz,);printf(/zwaitforasecondwithpatienee.nthesystemisexiting.n);getch();exit(O);)elseflag=O;廿0;while(fread(ftstudent

46、,sizeof(structperson),1,fp)if(strcmp(name,)=0)(printf(namettnumtchinese'tEnglishtmathsumtaveragen'z);printf(zz%-10s%-61d%-8.2f%-8.2f%-8.2f%-8.2f%-8.2fn/z,,student.num,student.chinese,student.English,student.math,student.sum,student.average);t=l;break;if(t0)printf(&quo

47、t;'Sorry,thestudentyouaresearchingnotexisted.nz,);rewind(fp);fclose(fp);Delete()(FILE*fp;structpersonstudentl30Z,student230;inti;intk;intj;intflag;charchi;charname20;charch;charch2;clrscr();fp=fopen(z/jie.txt","rb+);if(fp=NULL)(printf(can'topenthisfile.n);printf(z/waitforasecondwit

48、hpatienee.nthesystemisexiting.n);getch();exit(0);elsedo(i二0;j=0;flag=0;printf(inputthenameofstudentsyouaregoingtodelete.'n);seanf('%s,name);while(fread(&student,sizeof(structperson),1,fp)=l)(if(stremp(name,)!=0)(student2j=student;j+;else(flag二1;printfCname't't'tnu

49、mtchinesettEnglishttmathtsumtaveragen/);printf(,%-10s%-61d%8.2f%8.2f%8.2f%8.2f%8.2fn,z,,student.num,student.chinese,student.English,student.math,student.sum,student.average);printf(Delete(Y/N)?n");chl=getchar();getchar();toupper(ch);if(ch二二'N')gotoLoop;printf(产%dn,j);k二j;i二0

50、;fclose(fp);if(flag=0)printf("Sorry,thestudentyouaresearchingnotexisted.nz,);if(flag=l)printf("Congratulation!yousucceed!n");fp=fopen(jie.txt,“wb+);if(fp二二NULL)(printfCean'topenthisfile.n");printf(z,waitforasecondwithpatienee.nthesystemisexiting.n);getchO;exit(0);else(i二0;do(

51、fWrite(&student2i,sizeof(structperson),1,fp);i+;while(i<k);)Loop:getchar();printf(Goon(Y/N)?n);ch=getchar();getchar();while(ch-*y*ch二二'Y');printf("Showall(Y/N)?n");ch2=getchar();getchar();if(ch2='y'ch2='Y')rewind(fp);printfCnametttnumtchinesettEnglishttmathts

52、umtaveragenz/);while(fread(&student,sizeof(structperson),1,fp)(printf(zz%-10s%-61d%8.2f%8.2f%8.2f%8.2f%8.2fn'z,,student.num,student.chinese,student.English,student.math,student.sum,student.average);fclose(fp);return_confirm();Revise()(FILE*fp;charch;charchi;longoffset=sizeof(stru

53、ctperson);intflag=0;charnumstr20;charname20;clrscr();fp=fopen(z/jie.txt,rb+);if(fp=NULL)printf(can'topenthisfile.n);printf(,zwaitforasecondwithpatienee.nthesystemisexiting.n);getch();exit(0);)else(again:printfCnameofrivesingstudent:n);gets(name);do(flag=0;fread(ftstudent,sizeof(structperson),1,f

54、p);if(strcmp(name,)=0)flag;printf(z/thefollowingisinformationofstudentbeingdeleted:nz,);printfCnamettnumtmathtchinesetEnglishtsumtaveragen,z);printf(z,%-10s%-61d%8.2f%8.2f%8.2f%8.2f%8.2fn/z,,student.num,student.chinese,student.English,student.math,student.sum,student.average);do(printf(,z*informationsforrevising*n);printf("='n);printf(#1.name2.num#n);printf("#3.math4.English#n&

温馨提示

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

最新文档

评论

0/150

提交评论