




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
年4月19日C語言課程設計學生宿舍管理系統文檔僅供參考程序設計工程訓練報告學生宿舍管理系統課程名稱程序設計工程訓練姓名院(系)信息科學與技術學院專業班級學號指導教師教務處制目錄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("\\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)
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 【正版授權】 IEC 60076-8:1997 FR-D Power transformers - Part 8: Application guide
- 2025年大班下學期老師工作方案
- 2025年社區老年人重陽節活動方案
- 2025年個人工作方案支配
- 傳媒企業管理案例
- 注會審計課程分享
- 拓展課程文言文
- 避孕藥知識培訓課件視頻
- 2025年河北保定市容城博奧學校高三第四次(5月)模擬語文試題含解析
- 內蒙古豐州職業學院《空乘服務心理學》2023-2024學年第一學期期末試卷
- 日間手術出院后隨訪登記表
- 皮帶式渦流分選機構設計
- 典型示功圖分析(全)
- 波峰焊工程師面試試題集
- 招標代理工作服務流程圖
- ERP沙盤模擬軟件之三木工具完結版之修改版本
- 三一重裝EBZ260A掘進機各配件價格表
- O形密封圈用擋圈標準(共15頁)
- 海水上油氣田系統環境風險評估
- 警棍盾牌術_教案_圖
- 《招標采購》PPT課件.ppt
評論
0/150
提交評論