1、statistic();datasave();int n=0;int m=0;main()int i;printf(tttJiao wu guan li xi tong);nnttt Designer:chen ShuibaonntttGuaiding teacher:Liu WeirongnntElectronic Information Grade09 Class10 of University of Center SouthnntttJuly 4th,2010ntttPlease press Enter ingetch();for(; ;)system(clsntt *MENU*n1.D
2、ata inputtingtt2.Data deletingn3.Data changingttt4.Data searchingn5.data statistictt6.data saven7.exitninput your choice:nscanf(%d,&i);while(!(i=1|i=2|i=3|i=4|i=5|i=6|i=7) break;if(i=7) break;else switch(i)case 1:input();break;case 2:delete();case 3:case 4:case 5:case 6:default: void input()static s
3、truct Stu *p1,*p2;extern struct Stu *head;static int n;if(n=0) p1=(struct Stu*)malloc(sizeof(struct Stu);ninput class number name sex age coursenumber coursename xuefen testscore usualscore averagescore by orderndo m+;n=n+1;class:p1-class);number:%ldnumber);name:%s,p1-name);sex:sex);age:age);coursen
4、umber:coursenumber);coursename:coursename);xuefen:%fxuefen);testscore:testscore);usualscore:usualscore);averagescore=p1-testscore*0.7+p1-usualscore*0.3;if(n=1)head=p1;elsep2-next=p1;p2=p1;p1=(struct Stu*)malloc(sizeof(struct Stu);class=0;npress enter to input next record!others exitnwhile(getch()=rv
5、oid delete()struct Stu *p1,*p2;nYour choice:n1.name*2.number*nif(i=1)ninput the namen,name);if(head=0)nlist null! goto star;p1=head;while(strcmp(name,p1-name)&next!=0)p1=p1-next;if(!strcmp(name,p1-name)int i;nfind next record:%2d,number:%ld,name:%s,sex:%s,age:%d,coursenumber:%ld,coursename:%s,xuefen
6、:%.1f,testscore:%.1f,usualscore:%.1f,averagescore:%.1fclass,p1-number,p1-name,p1-sex,p1-age,p1-coursenumber,p1-coursename,p1-xuefen,p1-testscore,usualscore,p1-averagescore);nare you sure to delete it?press y/n: getchar();i=getchar();if(i=ym-;if(p1=head)head=p1-next=p1-the data is deletedreturn ;n%s
7、not been foundnelse if(i=2) long number;input the number:nlist nullngoto star;while(number!=p1-number&p2=p1;if(number=p1-number) int i;%.1fntestscore m-;ndelete:,number);else return ;n%ld not been found!else return;star: getch();change()struct Stu *p1;n1.name*2.number*ninput the name:printf(return;%
8、d,number:are you sure to change it?ninput new datasnelse printf(n%s not been found!ninput the number:press y/nsearch()n1.show all datas 2.search by number 3.search by namen4.search by score 5.back to main menunplease input your choice:if(head=NULL)nlist nullnhere are all the datas:while(p1-class!%.1
9、fnnnxuefen,testscore,p1-if(i=2)nplease input the number:if(i=3)if(i=4)ninput the averagescore:while(averagescore!averagescore&if(averagescore=p1-averagescore)n%.1f not been found!,averagescore);if(i=5)statistic()struct Stu *p1,*p2,*p,*p3;list null !i=m;p2=head;while(i!while(p2-p1=p2-if(p2-averagescorei-;nclass:,p2-class,p2-number,p2-name,p2-sex,p2-age,p2-coursenumber,p2-coursename,p2-testscore,p2-usualscore,p2-p2=p2-ne
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1