C语言专业课程设计学生宿舍标准管理系统_第1页
C语言专业课程设计学生宿舍标准管理系统_第2页
C语言专业课程设计学生宿舍标准管理系统_第3页
C语言专业课程设计学生宿舍标准管理系统_第4页
C语言专业课程设计学生宿舍标准管理系统_第5页
已阅读5页,还剩39页未读 继续免费阅读

下载本文档

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

文档简介

程序设计工程训练汇报学生宿舍管理系统课程名称程序设计工程训练姓名院(系)信息科学和技术学院专业班级学号指导老师教务处制目录96091需求分析 17782系统总框图和功效模块说明 210402.1系统总框图。 2149322.2功效模块说明 365822.3程序总体框架 4108673系统设计 1028783.1关键结构体 1042913.2关键功效函数 1096514调试情况 11242784.1输入密码进入程序 11210634.2主界面 11182624.2.1输入学生信息 11138784.2.2输出学生信息 1227844.2.3更新学生信息 12180964.2.4查询学生信息 13196574.2.5排序 1364184.2.6统计学生信息 14140585设计总结 14148446源程序清单 151需求分析输入正确密码后进入系统,用read_message()函数先读取文件内容,再在dowhile循环中用switch语句进行选择(选一进入输入模块;选二进入输出模块;选三进入更新模块,在更新模块中又包含了三个小模块:删除,修改,插入;选四进入查询模块,在查询模块中能够依据信息中学号,姓名,宿舍,楼层,楼号来进行查询;选五进入排序模块,在排序模块中能够依据学号,宿舍,楼层,楼号进行排序;选六进入统计模块,能够依据宿舍,楼层,楼号进行统计。)退出程序时,对信息进行保留,方便下次调用。

2系统总框图和功效模块说明2.1系统总框图1.输入函数(input_message()1.输入函数(input_message())2.输出函数(2.输出函数(output_message())3.读函数(read_message()3.读函数(read_message())a).删除函数(del_message())4.更新模块b).修改函数(revise_message())4.更新模块c)插入函数(insert_message())a).按姓名查询(inquire_name())主函数主函数5.查询模块c).按宿舍查询(inquire_dormitary())d).按楼层查询(inquire_floor())e).按宿舍楼查询(inquire_building())6.排序模块a).按学号排序(sort_num())6.排序模块b).按宿舍排序(sort_dormitary())c).按楼层排序(sort_floor())d).按宿舍楼排序(sort_building())7.统计模块a).按学号统计(count_num())7.统计模块b).按楼层统计(count_floor())c).按楼号统计(count_building())8.保留信息(8.保留信息(save_message())9.退出9.退出2.2功效模块说明1.输入函数:用来录入数据和相关信息。2.输出函数:用来输出录入相关信息。3.读函数:将文件中数据读入。4.更新模块:对以存信息进行更新.有以下多个选项:(1)删除函数:用来删除已离校学生信息。(2)修改函数:用来修改改变宿舍学生信息。(3)插入函数:用来插入新同学宿舍信息。5.查询模块:输入一项信息,能够得到存入整条信息,具体有以下:(1)按姓名查询:输入学生姓名,可得到整条学生信息。(2)按学号查询:输入学生学号,可得到整条学生信息。(3)按宿舍查询:输入宿舍号,可得到全部住在该宿舍号中学生全部信息。(4)按楼层查询:输入楼层数后,可得到全部住在该层学生信息。(5)按宿舍楼查询:输入宿舍楼数,可得到全部住在该楼学生信息。6.排序模块:用来对录入信息进行整理,使其排列有规律性。(1)按学号排序:把输入学号从小到大进行排序 。 (2)按宿舍排序:把输入宿舍从小到大进行排序 。(3)按楼层排序:把输入楼层从小到大进行排序 。(4)按宿舍楼排序:把输入宿舍楼从小到大进行排序 。7.统计模块:用来把录入信息进行统计,使使用者清楚明了。(1)按宿舍统计:输入要统计宿舍号,把这个宿舍里全部组员输出,并显示在这个宿舍里总人数。(2)按楼层统计:输入要统计楼层,把全部住在这个楼层上学生信息输出,并显示总人数。(3)按楼号统计:输入要统计楼号,把全部住在该楼学生信息输出,并显示总人数。8.保留信息:对信息进行保留,使下次打开时还存在。9.退出系统。2.3程序总体框架主函数步骤图:开始开始N输入密码输入密码Y读函数读函数输入choice输入choice进入输入模块Choice1进入输入模块Choice1进入输出模块Choice2进入输出模块Choice2N进入更新模块Choice3进入更新模块Choice3N进入查询模块Choice4进入查询模块Choice4N进入排序模块Choice5读函数进入排序模块Choice5读函数进入统计模块Choice6进入统计模块Choice6N退出Choice0退出Choice0保留函数保留函数结束结束修改模块步骤图:开始开始输入学号输入学号输入choice输入choicechoice=1?输入修改后num是choice=1?输入修改后num否输入修改后namechoice=2?是输入修改后namechoice=2?否输入修改后sexchoice=3?是输入修改后sexchoice=3?否输入修改后agechoice=4?是输入修改后agechoice=4?否输入修改后majorchoice=5?是输入修改后majorchoice=5?CChoice=6?输入修改后grade否是否是Choice=7?Choice=7?输入修改后class输入修改后class否是Choice=8?输入修改后buildingChoice=8?输入修改后building否输入修改后floor是C输入修改后floorChoice=9?否Choice=10?输入修改后dormiatry是Choice=10?输入修改后dormiatry输出修改后信息输出修改后信息结束结束查询模块步骤图:开始开始输入choice输入choiceInquire_namechoice=1?是Inquire_namechoice=1? 否Inquire_numchoice=2?是Inquire_numchoice=2?否是Inquire_dormitarychoice=3?Inquire_dormitarychoice=3?否Inquire_floorchoice=4?是Inquire_floorchoice=4?否choice=5?Inquire_building是choice=5?Inquire_building否choice=0?是choice=0?结束结束更新模块步骤图:开始开始输入choice输入choiceoutput_message(h)del_message(h)choice=1?是output_message(h)del_message(h)choice=1? 否output_message(h)revise_message()choice=2?是output_message(h)revise_message()choice=2?否是output_message(h)insert_message(h);choice=3?output_message(h)insert_message(h);choice=3?choice=0?是choice=0?结束结束删除模块步骤图:开始开始输入num输入nump0=hp0=hp=p0->nextp=p0->nextp->num==nump0->next=p->next;free(p);p->num==nump0->next=p->next;free(p);否p0=p;p=p->next;p0=p;p=p->next;p=p->next;结束否按姓名查询步骤图:开始开始输入name输入namep0=h p0=hstrcmp(p0->name,name)strcmp(p0->name,name)?==0是输出p0输出p0否p0=p0->nextp0=p0->next结束结束(按学号、宿舍号、楼层、宿舍楼步骤图类似于按姓名查询步骤图)排序模块步骤图:开始开始输入choice输入choiceoutput(h)sort_num()choice=1?是output(h)sort_num()choice=1? 否output(h)sort_dormitary()choice=2?是output(h)sort_dormitary()choice=2?否是choice=3?choice=3?sort_floor()output(h)否choice=4?sort_building()choice=4?sort_building()output(h)否choice=0?是choice=0?结束结束统计模块步骤图:开始开始输入choice输入choicecount_dormitary()choice=1?是count_dormitary()choice=1? 否count_floor()choice=2?是count_floor()choice=2?否是count_building()choice=3?count_building()choice=3?choice=0?是choice=0?结束结束3系统设计3.1关键结构体structstud{intnum;charname[10];charsex[8];intage;charmajor[18];intgrade;intclasses;intbuilding;intfloor;intdormitary;structstud*next;};3.2关键功效函数input_message()/*输入模块*/read_message()/*读取信息*/output_message(structstud*p)/*输出模块*/del_message(structstud*h)/*删除学生信息*/revise_message()/*修改学生信息*/insert_message(structstud*h)/*插入学生信息*/renew_message()/*更新模块*/inquire_name()/*按姓名查询*/inquire_num()/*按学号查询*/inquire_dormitary()/*按宿舍号查询*/inquire_floor()/*按楼层查询*/inquire_building()/*按宿舍楼查询*/inquire_message()/*查询模块*/sort_num()/*按学号排序*/sort_dormitary()/*按宿舍排序*/sort_floor()/*按楼层排序*/sort_building()/*按宿舍楼排序*/output(structstud*p)/*用于输出排序模块*/sort_message()/*排序模块*/count_floor()/*按楼层统计*/count_building()/*按宿舍楼统计*/count_message()/*统计模块*/save_message(structstud*h)/*保留信息*/4调试情况4.1输入密码进入程序4.2主界面4.2.1输入学生信息输入一共有多少个学生信息完成一个学生信息登记4.2.2输出学生信息4.2.3更新学生信息可图:(修改王安性别)4.2.4查询学生信息可图:(按宿舍楼查询)4.2.5排序4.2.6统计学生信息图:(按楼层统计)该程序中可能还存在部分小问题,比如有时候它会主动清屏,有时候不会。而且我在编译过程中发觉自己存在好多毛病,有粗心了等,不注意细节,其实自己也知道细节决定成败,以后我会注意。5设计总结经过两周编程,我完成了学生宿舍管理这个小系统。深入了解并掌握了C语言中精华指针和键表。程序能够流畅运行,实现对数据录入、修改、插入、删除、排序、查询、统计等基础功效。程序开始时从文件中读取数据,结束时对新数据或更新数据进行保留,方便下次再次调用。在编程中也不是一帆风顺,开始时因为对C语言很多知识点全部遗忘了,造成编程过程中相当吃力,经过一两天适应后,模块基础上编得心应手。但当我编写读数据这个模块时碰到了一点问题,程序总是读出部分乱码,并不是我先前存入数据。经过指导老师耐心指点下,最终处理了这个问题。这次高级语言程序设计,不仅巩固了我所学到C语言知识,还让我认识到了编写一个完整程序不仅要有必备基础知识,还要耐心,细心,碰到问题不能轻言放弃,灵感可能就会出现在下一秒。课程设计是把我们所学理论知识进行系统总结并应用于实践良好机会,有利于加强我们用知识理论来分析实际问题能力,进而加强了我们对知识认识实践度,巩固了我们理论知识,深化了对知识认识,并为走向社会打下一个良好基础。在这次课程设计中我碰到很多问题和麻烦,得到了老师帮助和指导,才能够使得这次课程设计顺利进行下去,另外,在程序调试过程中,也得到很多同学帮助,给我立即指犯错误,提出很多宝贵意见。在此对老师和同学们表示感谢!6源程序清单#include<stdio.h>#include<string.h>#include<stdlib.h>#defineNsizeof(structstud)/*先用结构体定义学生信息*/structstud{intnum;charname[10];charsex[8];intage;charmajor[18];intgrade;intclasses;intbuilding;intfloor;intdormitary;structstud*next;/*next是指向本结构体类型指针类型*/};structstud*h,*p;/*定义指向结构体指针变量*/FILE*fp;/*定义文件指针*//*建立和输出链表*/structstud*creat(void){structstud*p1,*p2,*head;inti,k;printf("Pleaseinputthetotalnumberofstudents:\n");scanf("%d",&k);head=NULL;printf("Pleaseinputthemessageofthestudent:\n\n");if(k>0){head=p2=p1=(structstud*)malloc(N);/*为head,p2,p1申请存放空间,并全部指向首结点*/for(i=1;i<=k;i++){p1=(structstud*)malloc(N);printf("Pleaseinputthenumberofthestudent:\n");scanf("%d",&p1->num);printf("Inputthename:\n");scanf("%s",p1->name);printf("Inputthesex(manorfemale):\n");scanf("%s",p1->sex);printf("Inputtheage:\n");scanf("%d",&p1->age);printf("Inputthemajor:\n");scanf("%s",p1->major);printf("Pleaseinputthegradeandclass:\n");scanf("%d%d",&p1->grade,&p1->classes);printf("Pleaseinputthebuildingflooranddormitary:\n");scanf("%d%d%d",&p1->building,&p1->floor,&p1->dormitary);p2->next=p1;/*将新结点连到表尾*/p2=p1;/*p2指向新表尾*/}p2->next=NULL;head=head->next;}save_message(head);/*将输入数据存入文件*/returnhead;}/*输入模块*/input_message(){charv;system("cls");h=creat();fflush(stdin);printf("\n\n\n\n\pressanykeytothemainmeue!!!!\n");v=getchar();return;}/*读取信息*/read_message(){structstud*p1,*p2;h=p1=(structstud*)malloc(N);/*为了p1申请存放空间,并指向首结点*/if((fp=fopen("gx1.txt","rb"))==NULL){printf("\n\n\nThereisnodataforthemonent!\n");return;}if(fread(p1,N,1,fp)!=1)return;/*先向p1读入一个数据,若不能读,返回*/while(1){p2=(structstud*)malloc(N);/*为了p2申请存放空间*/if(fread(p2,N,1,fp)!=1)break;p1->next=p2;p1=p2;}fclose(fp);return;}/*输出模块*/output_message(structstud*p){charv; p=h;system("cls");if(p==NULL)printf("\n\n\n\n\nThereisnodatasrightnow!\n");printf("numbernamesexagemajorgradeclassbuildingfloordormitary\n\n");while(p!=NULL){printf("%6d%7s%7s%6d%8s%8d%8d%10d%7d%11d\n",p->num,p->name,p->sex,p->age,p->major,p->grade,p->classes,p->building,p->floor,p->dormitary);p=p->next;}fflush(stdin);printf("\n\n\n\n\pressanykeytothemainmeue!!!!\n");v=getchar();return;}/*删除学生信息*/del_message(structstud*h){intnum;structstud*p,*p0;system("cls");if(h==NULL)return0;printf("\n\nPleaseinputthenumberwhoyouwhattodelete?\n");scanf("%d",&num);p0=h;if(p0->num==num){h=p0->next;free(p0);/*若首结点是所要删除数据,则释放首结点*/return1;}p=p0->next;while(p!=NULL){if(p->num==num){p0->next=p->next;free(p);return1;}p0=p;p=p->next;}return0;}/*修改学生信息*/revise_message(){intnum1,choice;structstud*p0;system("cls");printf("\n\nPleaseinputthenumberwhoyouwhattorevise:\n");scanf("%d",&num1);system("cls");p0=h;/*将头结点赋给p0*/do{if(p0->num==num1){printf("\nWhichyouwhattorevise?\n");printf("\n1.number\n");printf("\n2.name\n");printf("\n3.sex\n");printf("\n4.age\n");printf("\n5.major\n");printf("\n6.grade\n");printf("\n7.class\n");printf("\n8.building\n");printf("\n9.floor\n");printf("\n10.dormiatry\n");scanf("%d",&choice);switch(choice){case1:printf("\nInputthenewnumber:\n");scanf("%d",&p0->num);break;case2:printf("\nInputthenewname:\n");scanf("%s",p0->name);break;case3:printf("\nInputthenewsex:\n");scanf("%s",p0->sex);break;case4:printf("\nInputthenewage:\n");scanf("%d",&p0->age);break;case5:printf("\nInputthenewmajor:\n");scanf("%s",p0->major);break;case6:printf("\nInputthenewgrade:\n");scanf("%d",&p0->grade);break;case7:printf("\nInputthenewclass:\n");scanf("%d",&p0->classes);break;case8:printf("\nInputthenewbuilding:\n");scanf("%d",&p0->building);break;case9:printf("\nInputthenewfloor:\n");scanf("%d",&p0->floor);break;case10:printf("\nInputthenewdormitary:\n");scanf("%d",&p0->dormitary);break;}break;}elsep0=p0->next;}while(p0!=NULL);}/*插入学生信息*/insert_message(structstud*h){structstud*p,*p0;p=(structstud*)malloc(N);system("cls");printf("Pleaseinputthenumberofthestudent:\n");scanf("%d",&p->num);printf("Inputthename:\n");scanf("%s",p->name);printf("Inputthesex(manorfemale):\n");scanf("%s",p->sex);printf("Inputtheage:\n");scanf("%d",&p->age);printf("Inputthemajor:\n");scanf("%s",p->major);printf("Pleaseinputthegradeandclass:\n");scanf("%d%d",&p->grade,&p->classes);printf("Pleaseinputthebuildingflooranddormitary:\n");scanf("%d%d%d",&p->building,&p->floor,&p->dormitary);p->next=NULL;if(h==NULL){h=p;return1;}p0=h;if((p0->num)>(p->num))/*按学号次序插入*/{p->next=h;h=p;return1;}while((p0->next)!=NULL&&(p0->next->num)<(p->num))p0=p0->next;if(p0->next==NULL){p0->next=p;return1;}elseif((p0->next->num)==(p->num)){free(p);return0;}p->next=p0->next;p0->next=p;return1;}/*更新模块*/renew_message(){intchoice;do{system("cls");printf("\n\n\n~~~~~~~~'Renewmessage~~~~~~~~\n\n");printf("1.Deletemessage\n\n");printf("2.Revisemessage\n\n");printf("3.Insertmessage\n\n");printf("0.Returnthemainmenu\n\n");printf("Pleasechoice(0-3):");scanf("%d",&choice);switch(choice){case1:del_message(h);output_message(h);break;case2:revise_message();output_message(h);break;case3:insert_message(h);output_message(h);break;case0:break;}}while(choice!=0);}/*按姓名查询*/inquire_name(){charv,name[10];structstud*p0;system("cls");printf("\n\n\nPleaseinputthenamewhoyouwhattofind:\n\n");scanf("\n%s",name);p0=h;while(p0!=NULL){if(strcmp(p0->name,name)==0)/*用比较函数比较*/{printf("\n\n************************Inquirebyname*************************\n\n");printf("numbernamesexagemajorgradeclassbuildingfloordormitary\n\n");printf("%6d%7s%7s%6d%8s%8d%8d%10d%7d%11d\n",p0->num,p0->name,p0->sex,p0->age,p0->major,p0->grade,p0->classes,p0->building,p0->floor,p0->dormitary);}p0=p0->next;}fflush(stdin);printf("\n\n\n\n\pressanykeytothemainmeue!!!!\n");v=getchar();return;}/*按学号查询*/inquire_num(){charv; intnum2;structstud*p0;system("cls");printf("\n\n\nPleaseinputthenumberwhoyouwhattofind:\n\n");scanf("\n%d",&num2);p0=h;while(p0!=NULL){if(p0->num==num2){printf("\n\n****************************Inquirebynumber**************************\n\n");printf("numbernamesexagemajorgradeclassbuildingfloordormitary\n\n");printf("%6d%7s%7s%6d%8s%8d%8d%10d%7d%11d\n",p0->num,p0->name,p0->sex,p0->age,p0->major,p0->grade,p0->classes,p0->building,p0->floor,p0->dormitary);}p0=p0->next;}fflush(stdin);printf("\n\n\n\n\pressanykeytothemainmeue!!!!\n"); v=getchar();return;}/*按宿舍号查询*/inquire_dormitary(){charv; intdormitary2;structstud*p0;system("cls");printf("\n\n\nPleaseinputthedormitarywhatyouwanttofind:\n\n");scanf("\n%d",&dormitary2);p0=h;while(p0!=NULL){if(p0->dormitary==dormitary2){printf("\n\n*********************Inquirebydormitary**********************\n\n");printf("numbernamesexagemajorgradeclassbuildingfloordormitary\n\n");printf("%6d%7s%7s%6d%8s%8d%8d%10d%7d%11d\n",p0->num,p0->name,p0->sex,p0->age,p0->major,p0->grade,p0->classes,p0->building,p0->floor,p0->dormitary);}p0=p0->next;}fflush(stdin);printf("\n\n\n\n\pressanykeytothemainmeue!!!!\n");v=getchar();return;}/*按楼层查询*/inquire_floor(){charv; intfloor2;structstud*p0;system("cls");printf("\n\n\nPleaseinputthefloorwhatyouwanttofind:\n\n");scanf("%d",&floor2);p0=h;while(p0!=NULL){if(p0->floor==floor2){printf("\n\n*************************Inquirebyfloor**************************\n\n");printf("numbernamesexagemajorgradeclassbuildingfloordormitary\n\n");printf("%6d%7s%7s%6d%8s%8d%8d%10d%7d%11d\n",p0->num,p0->name,p0->sex,p0->age,p0->major,p0->grade,p0->classes,p0->building,p0->floor,p0->dormitary);}p0=p0->next;}fflush(stdin);printf("\n\n\n\n\pressanykeytothemainmeue!!!!\n");v=getchar();return;}/*按宿舍楼查询*/inquire_building(){charv; intbuilding2;structstud*p0;system("cls");printf("\n\n\nPleaseinputthebuildingwhoyouwhattofind:\n\n");scanf("%d",&building2);p0=h;while(p0!=NULL){if(p0->building==building2){printf("\n\n***************************Inquirebybuilding*****************************\n\n");printf("numbernamesexagemajorgradeclassbuildingfloordormitary\n\n");printf("%6d%7s%7s%6d%8s%8d%8d%10d%7d%11d\n",p0->num,p0->name,p0->sex,p0->age,p0->major,p0->grade,p0->classes,p0->building,p0->floor,p0->dormitary);}p0=p0->next;}fflush(stdin);printf("\n\n\n\n\pressanykeytothemainmeue!!!!\n");v=getchar();return;}/*查询模块*/inquire_message(){intchoice;do{system("cls");printf("\n\n\n~~~~~~~~InquireMessage~~~~~~~~\n\n");printf("1.Inquirebyname\n\n");printf("2.Inquirebynumber\n\n");printf("3.Inquirebydorminary\n\n");printf("4.Inquirebyfloor\n\n");printf("5.Inquirebybuilding\n\n");printf("0.Returnthemainmenu\n\n");printf("Pleasechoice(0-5):");scanf("%d",&choice);switch(choice){case1:inquire_name();break;case2:inquire_num();break;case3:inquire_dormitary();break;case4:inquire_floor();break;case5:inquire_building();break;case0:break;}}while(choice!=0);}/*按学号排序*/sort_num(){structstud*p0,*m,*n,*q;structstuds1;p0=h;system("cls");printf("\n\n***************Sortbynumber*************\n\n");while((p0->next)!=NULL)/*此循环用于控制头指针*/{q=p0->next;while(q!=NULL)/*此循环用于控制第二指针*/{if((p0->num)>(q->num)){m=q->next;n=p0->next;s1=*p0;*p0=*q;*q=s1;q->next=m;/*使上面改变对p0和q不影响*/p0->next=n;}q=q->next;}p0=p0->next;}}/*按宿舍排序*/sort_dormitary(){structstud*p0,*m,*n,*q;structstuds2;p0=h;system("cls");printf("\n\n*****************Sortbydormitary****************\n\n");while((p0->next)!=NULL){q=p0->next;while(q!=NULL){if((p0->dormitary)>(q->dormitary)){m=q->next;n=p0->next;s2=*p0;*p0=*q;*q=s2;q->next=m;p0->next=n;}q=q->next;}p0=p0->next;}}/*按楼层排序*/sort_floor(){structstud*p0,*m,*n,*q;structstuds3;p0=h;system("cls");printf("\n\n*****************Sortbyfloor****************\n\n");while((p0->next)!=NULL){q=p0->next;while(q!=NULL){if((p0->floor)>(q->floor)){m=q->next;n=p0->next;s3=*p0;*p0=*q;*q=s3;q->next=m;p0->next=n;}q=q->next;}p0=p0->next;}}/*按宿舍楼排序*/sort_building(){structstud*p0,*m,*n,*q;structstuds4;p0=h;system("cls");printf("\n\n*****************Sortbybuilding****************\n\n");while((p0->next)!=NULL){q=p0->next;while(q!=NULL){if((p0->building)>(q->building)){m=q->next;n=p0->next;s4=*p0;*p0=*q;*q=s4;q->next=m;p0->next=n;}q=q->next;}p0=p0->next;}}/*用于输出排序模块*/output(structstud*p){charv; p=h;printf("numbernamesexagemajorgradeclassbuildingfloordormitary\n\n");while(p!=NULL){printf("%6d%7s%7s%6d%8s%8d%8d%10d%7d%11d\n",p->num,p->name,p->sex,p->age,p->major,p->grade,p->classes,p->building,p->floor,p->dormitary);p=p->next;}fflush(stdin);printf("\n\n\n\n\pressanykeytothemainmeue!!!!\n");v=getchar();return;}/*排序模块*/sort_message(){intchoice;do{system("cls");printf("\n\n\n~~~~~~~~~~~~~~~Sortmessage~~~~~~~~~~~~~~~\n\n");printf("1.Sortbynumber\n\n");printf("2.Sortbydormitary\n\n");printf("3.Sortbyfloor\n\n");printf("4.Sortbybuilding\n\n");printf("0.Returnthemainmenu\n\n");printf("Pleasechoice(0-4):");scanf("%d",&choice);switch(choice){case1:sort_num();output(h);break;/*调用output_message()使排好数据输出*/case2:sort_dormitary();output(h);break;case3:sort_floor();output(h);break;case4:sort_building();output(h);break;case0:break;}}while(choice!=0);}/*按宿舍号统计*/count_dormitary(){charv; structstud*p;intdor;inti=0;system("cls");printf("\n\nPleaseinputthedormitarywhatyouwanttocount:\n");scanf("%d",&dor);system("cls");printf("\n\n*************************Countbydormitary***********************************\n");printf("\n\nnumbernamesexagemajorgradeclassbuildingfloordormitary\n\n");p=h;while(p!=NULL){if(p->dormitary==dor){printf("%6d%7s%7s%6d%8s%8d%8d%10d%7d%11d\n",p->num,p->name,p->sex,p->age,p->major,p->grade,p->classes,p->building,p->floor,p->dormitary);i++;}p=p->next;}printf("\nThetotal:%d",i);fflush(stdin);printf("\n\n\n\n\pressanykeytothemainmeue!!!!\n");v=getchar();return;}/*按楼层统计*/count_floor(){charv; structstud*p;intflo;inti=0;system("cls");printf("\n\nPleaseinputthefloorwhatyouwanttocount:\n");scanf("%d",&flo);system("cls");printf("\n\n*******************************Countbyfloor********************************\n");printf("\n\nnumbernamesexagemajorgradeclassbuildingfloordormitary\n\n");p=h;while(p!=NULL){if(p->floor==flo){printf("%6d%7s%7s%6d%8s%8d%8d%10d%7d%11d\n",p->num,p->name,p->sex,p->age,p->major,p->grade,p->classes,p->building,p->floor,p->dormitary);i++;}p=p->next;}printf("\nThetotal:%d",i);fflush(stdin);printf("\n\n\n\n\pressanykeytothemainmeue!!!!\n");v=getchar();return;}/*按宿舍楼统计*/count_building(){charv; structstud*p;intbui;inti=0;system("cls");printf("\n\nPleaseinputthebuildingwhatyouwanttocount:\n");scanf("%d",&bui);system("cls");printf("\n\n*******************************Countbybuilding********************************\n");printf("\n\nnumbernamesexagemajorgradeclassbuildingfloordormitary\n\n");p=h;while(p!=NULL){if(p->building==bui){printf("%6d%7s%7s%6d%8s%8d%8d%10d%7d%11d\n",p->num,p->name,p->sex,p->a

温馨提示

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

最新文档

评论

0/150

提交评论