




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、#include#include#includetypedef struct Student char name20; char sex5; int age; char institute20; char specialty30; Student;typedef struct Room int roomnum; int roomarea; int totalnum; int stunum; Student stu10; Room *next; Room; typedef struct Story char storynum; Room *room; Story;/*-*/ Student *S
2、tudentCreat(int age,char name,char institute,char specialty,char sex) Student *Stu; Stu=(Student *)malloc(sizeof(Student); Stu-age=age; strcpy(Stu-institute,institute); strcpy(Stu-name,name); strcpy(Stu-specialty,specialty); strcpy(Stu-sex,sex); return Stu; Room *RoomCreat(int room_num,int room_area
3、,int total_num,int stu_num) Room *R; int i; R=(Room *)malloc(sizeof(Room); if(!R)return NULL; R-roomnum=room_num; R-roomarea=room_area; R-totalnum=total_num; R-stunum=stu_num; R-next=NULL; return R; Story *StoryCreat() Story *S; S=(Story *)malloc(sizeof(Story); S-room=RoomCreat(0,0,0,0); return S;St
4、ory *DormCreat() Story *S,*control; char i; control=(Story *)malloc(26*sizeof(Story); if(!control)return NULL; for(i=A;istorynum=i; controli-A=*S; return control;/*-*/ Story *StorySearch(Story *control,char storynum) return control+(storynum-A);Room *RoomSearch(Room *R,int room_num) while(R-next!=NU
5、LL) if(R-next-roomnum=room_num)break; else R=R-next; return R;Student *StudentSearch(Room *R,char name) Student *p; int i; R=R-next; p=R-stu; for(i=0;istunum;i+) if(strcmp(p-name,name)=0)return p; else p+; return NULL; /*-*/ void RoomInsert(Story *S,Room *R) R-next=S-room-next; S-room-next=R;void St
6、udentInsert(Room *R,Student *Stu) R=R-next; R-stuR-stunum=*Stu; R-stunum+;void RoomDelete(Room *R) Room *p; R=R-next; p=R; R=R-next; free(p);void StudentDelete(Room *R,Student *Stu) R=R-next; Student *p; for(p=R-stu;Stustunum-1;Stu+)*Stu=*(Stu+1); R-stunum-;void RoomRevamp(Room *R) int i,k; R=R-next
7、; printf(1、房號(hào) 2、面積 3、可容納人數(shù):n); printf(要修改那一項(xiàng):n); scanf(%d,&i); switch(i) case 1: printf(房號(hào):); scanf(%d,&k); R-roomnum=k; break; case 2: printf(面積:); scanf(%d,&k); R-roomarea=k; break; case 3: printf(可容納人數(shù):); scanf(%d,&k); R-totalnum =k; break; void StudentRevamp(Student *Stu) int i,k; char str30; pr
8、intf(1、姓名 2、性別 3、學(xué)院 4、專業(yè) 5、年齡:n); printf(要修改那一項(xiàng):n); scanf(%d,&i); switch(i) case 1: printf(姓名:); scanf(%s,str); strcpy(Stu-name,str); break; case 2: printf(性別:); scanf(%s,str); strcpy(Stu-sex,str); break; case 3: printf(學(xué)院:); scanf(%s,str); strcpy(Stu-institute,str); break; case 4: printf(專業(yè):); scan
9、f(%s,str); strcpy(Stu-specialty,str); break; case 5: printf(年齡:); scanf(%d,&k); Stu-age =k; break; /*-*/ void RoomScan(Room *R) int i; Student *p; R=R-next; printf(房號(hào):%dn,R-roomnum); printf(面積:%dn,R-roomarea); printf(可容納人數(shù):%dn,R-totalnum); printf(已住入人數(shù):%dn,R-stunum); printf(成員:); for(i=0;istunum;i+)
10、 p=&(R-stui); printf(%s ,p-name); putchar(n);void StudentScan(Student *Stu) printf(姓名:%sn,Stu-name); printf(年齡:%dn,Stu-age); printf(性別:%sn,Stu-sex); printf(學(xué)院:%sn,Stu-institute); printf(專業(yè):%sn,Stu-specialty);int main() int roomnum,roomarea,totalnum,stunum,age; int event; char name20,institute20,spec
11、ialty30,sex5; char storynum,judge; Story *control; Story *S; Room *R; Student *Stu; control=DormCreat(); do printf(*注意*n); printf(* 先錄入宿舍信息才能錄入學(xué)生信息 *n); printf(* 先錄入信息才能刪除瀏覽或修改信息 *n); printf(*n); printf(nnn 宿舍管理系統(tǒng) nnn); printf(功能選擇菜單:n); printf(1、宿舍信息錄入 2、學(xué)生信息錄入 3、刪除某個(gè)宿舍 4、刪除某個(gè)學(xué)生n); printf(5、宿舍信息瀏覽
12、6、學(xué)生信息瀏覽 7、宿舍信息修改 8、學(xué)生信息修改n); scanf(%d,&event); switch(event) case 1: do printf(請(qǐng)輸入宿舍房間號(hào),房間面積,可容納人數(shù),已住入人數(shù):(以空格隔開(kāi))n); fflush(stdin); scanf(%c%d %d %d %d,&storynum,&roomnum,&roomarea,&totalnum,&stunum); S=StorySearch(control,storynum); R=RoomCreat(roomnum,roomarea,totalnum,stunum); RoomInsert(S,R); pr
13、intf(宿舍信息錄入成功!n); fflush(stdin); printf(是否繼續(xù)錄入宿舍信息(Y/N)n); scanf(%c,&judge); while(judge=Y); break; case 2: do printf(請(qǐng)輸入該生要入住的宿舍:n); fflush(stdin); scanf(%c%d,&storynum,&roomnum); fflush(stdin); S=StorySearch(control,storynum); R=S-room; R=RoomSearch(R,roomnum); printf(請(qǐng)輸入該生姓名,性別,學(xué)院,專業(yè),年齡:(以空格隔開(kāi))n)
14、; scanf(%s%s%s%s,name,sex,institute,specialty); scanf(%d,&age); Stu=StudentCreat(age,name,institute,specialty,sex); StudentInsert(R,Stu); printf(學(xué)生信息錄入成功!n); fflush(stdin); printf(是否繼續(xù)錄入學(xué)生信息(Y/N)n); scanf(%c,&judge); while(judge=Y); break; break; case 3: do printf(請(qǐng)輸入要?jiǎng)h除的宿舍號(hào)碼:n); fflush(stdin); scan
15、f(%c%d,&storynum,&roomnum); fflush(stdin); S=StorySearch(control,storynum); R=S-room; R=RoomSearch(R,roomnum); RoomDelete(R); printf(宿舍信息刪除成功!n); fflush(stdin); printf(是否繼續(xù)刪除宿舍信息(Y/N)n); scanf(%c,&judge); while(judge=Y); break; break; case 4: do printf(請(qǐng)輸入要?jiǎng)h除學(xué)生現(xiàn)住宿舍:n); fflush(stdin); scanf(%c%d,&sto
16、rynum,&roomnum); fflush(stdin); S=StorySearch(control,storynum); R=S-room; R=RoomSearch(R,roomnum); printf(請(qǐng)輸入要?jiǎng)h除學(xué)生的姓名:n); scanf(%s,name); Stu=StudentSearch(R,name); StudentDelete(R,Stu); printf(學(xué)生信息刪除成功!n); fflush(stdin); printf(是否繼續(xù)刪除學(xué)生信息(Y/N)n); scanf(%c,&judge); while(judge=Y); break; break; cas
17、e 5: do printf(請(qǐng)輸入要瀏覽的宿舍號(hào)碼:n); fflush(stdin); scanf(%c%d,&storynum,&roomnum); fflush(stdin); S=StorySearch(control,storynum); R=S-room; R=RoomSearch(R,roomnum); RoomScan(R); fflush(stdin); printf(是否繼續(xù)瀏覽宿舍(Y/N)n); scanf(%c,&judge); while(judge=Y); break; break; case 6: do printf(請(qǐng)輸入要瀏覽學(xué)生的宿舍號(hào)碼:n); ffl
18、ush(stdin); scanf(%c%d,&storynum,&roomnum); fflush(stdin); S=StorySearch(control,storynum); R=S-room; R=RoomSearch(R,roomnum); printf(請(qǐng)輸入要瀏覽學(xué)生的姓名:n); scanf(%s,name); Stu=StudentSearch(R,name); StudentScan(Stu); fflush(stdin); printf(是否繼續(xù)瀏覽學(xué)生(Y/N)n); scanf(%c,&judge); while(judge=Y); break; break; case 7: do printf(請(qǐng)輸入要修改的宿舍號(hào)碼:n); fflush(stdin); scanf(%c%d,&storynum,&roomnum); fflush(stdin); S=StorySearch(contro
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 如何定義公司使命目標(biāo)試題及答案
- 經(jīng)典案例的試題及答案
- 系統(tǒng)性能監(jiān)控的常用工具試題及答案
- 2025年中國(guó)防撞膠市場(chǎng)調(diào)查研究報(bào)告
- 法學(xué)概論考試準(zhǔn)備Checklist試題及答案
- 探索網(wǎng)絡(luò)設(shè)備的基本配置試題及答案
- 2025年中國(guó)銀章市場(chǎng)調(diào)查研究報(bào)告
- 網(wǎng)絡(luò)管理員考試思路解析試題及答案
- 商業(yè)模式的創(chuàng)新與戰(zhàn)略安全試題及答案
- 國(guó)有企業(yè)試題及答案
- 2025年碩士研究生政治考研大綱
- 電子商務(wù)教師資格證教學(xué)理念試題及答案
- 武漢2025屆高中畢業(yè)生二月調(diào)研考試數(shù)學(xué)試題及答案
- 山東省日照市2024-2025學(xué)年高一上學(xué)期期末數(shù)學(xué)試題(原卷版+解析版)
- 人教版四年級(jí)數(shù)學(xué)下冊(cè)《圖形的運(yùn)動(dòng)(二)》試題(含答案)
- 換電站工程施工方案
- 2025年易拉罐項(xiàng)目可行性研究報(bào)告
- 企業(yè)員工分紅合同規(guī)定
- 2025年交管12123駕駛證學(xué)法減分題庫(kù)與參考答案
- 2025年《教師專業(yè)成長(zhǎng)與專業(yè)發(fā)展》培訓(xùn)心得(3篇)
- 2025年重慶市環(huán)衛(wèi)集團(tuán)有限公司招聘筆試參考題庫(kù)含答案解析
評(píng)論
0/150
提交評(píng)論