宿舍管理系统源代码(11页).doc
《宿舍管理系统源代码(11页).doc》由会员分享,可在线阅读,更多相关《宿舍管理系统源代码(11页).doc(11页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
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 *
2、StudentCreat(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_are
3、a,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;S
4、tory *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!=N
5、ULL) 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 S
6、tudentInsert(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-nex
7、t; printf(1、房号 2、面积 3、可容纳人数:n); printf(要修改那一项:n); scanf(%d,&i); switch(i) case 1: printf(房号:); scanf(%d,&k); R-roomnum=k; break; case 2: printf(面积:); scanf(%d,&k); R-roomarea=k; break; case 3: printf(可容纳人数:); scanf(%d,&k); R-totalnum =k; break; void StudentRevamp(Student *Stu) int i,k; char str30; p
8、rintf(1、姓名 2、性别 3、学院 4、专业 5、年龄:n); printf(要修改那一项: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(学院:); scanf(%s,str); strcpy(Stu-institute,str); break; case 4: printf(专业:); sca
9、nf(%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(房号:%dn,R-roomnum); printf(面积:%dn,R-roomarea); printf(可容纳人数:%dn,R-totalnum); printf(已住入人数:%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(学院:%sn,Stu-institute); printf(专业:%sn,Stu-specialty);int main() int roomnum,roomarea,totalnum,stunum,age; int event; char name20,institute20,spe
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 宿舍 管理 系统 源代码 11
限制150内