《宾馆客户管理系统源代码.docx》由会员分享,可在线阅读,更多相关《宾馆客户管理系统源代码.docx(5页珍藏版)》请在三一办公上搜索。
1、宾馆客户管理系统源代码#define NULL 0 #define LEN sizeof(struct customer) #include string.h struct customer int num; char name20; char sex; int age; char jg60; char ID20; char birthday20; char mz10; char addr40; char gzdw60; long date; struct customer *next; cus; struct customer *creat(void) struct customer *he
2、ad,*p1,*p2; int n=0; p1=(struct customer *)malloc(LEN); p2=(struct customer *)malloc(LEN); printf(qing shu ru ke hu de xin xi:n); printf(nfangjian:); scanf(%d,&p1-num); printf(n); printf(xingming:); scanf(%s,p1-name); printf(n); printf(xingbie:); scanf(%c,&p1-sex); printf(n); printf(jiguan:); scanf(
3、%s,p1-jg); printf(n); printf(shenfenzhenghaoma:); scanf(%s,p1-ID); printf(n); printf(chushengriqi:); scanf(%s,p1-birthday); printf(n); printf(minzu:); scanf(%s,p1-mz); printf(n); printf(jiatingzhuzhi:); scanf(%s,p1-addr); printf(n); printf(gongzuodanwei;); scanf(%s,p1-gzdw); printf(n); printf(ruzhus
4、hijian:); scanf(%ld,&p1-date); printf(n); head=NULL; while(p1-num!=0) n+; if(n=1) head=p1; else p2-next=p1; p2=p1; p1=(struct customer *)malloc(LEN); printf(qingshurukehudexinxi:n); printf(nfangjian:); scanf(%d,&p1-num); printf(n); printf(xingming:); scanf(%s,p1-name); printf(n); printf(ruzhushijian
5、:); scanf(%ld,&p1-date); printf(n); p2-next=NULL; return(head); struct customer *insert(struct customer *head,struct customer *consumer) struct customer *p1,*p2; p1=head; p2=consumer; if(p1-next!=NULL) p1=p1-next; if(p1-next=NULL) p1-next=p2; p2-next=NULL; return(head); struct customer *del(struct c
6、ustomer *head,int num) struct customer *p1,*p2; if(head=NULL) printf(meiyoukehuxinxin); return(head); p1=head; while(num!=p1-num&p1-next!=NULL) p2=p1;p1=p1-next; if(num=p1-num) if(p1=head) head=p1-next; else p2-next=p1-next; printf(tuifangxinxi:n); printf(kefang:%dn,&p1-num); printf(xingming:%sn,p1-
7、name); printf(ruzhushijian:%ldn,&p1-date); else printf(meiyougaikehudexinxin); return(head); struct customer *search(struct customer *head,char c_name) struct customer *p; p=head; while(strcmp(p-name,c_name)&p-next!=NULL) p=p-next; if(p-name=c_name) printf(gaikehudexinxiwei:n); printf(fangjian:%dnxi
8、ngming:%Snruzhushijian:%ld,p-num,p-name,p-date); if(p-name!=c_name&p-next=NULL) printf(meiyougaikehuxinxi!n); void print(struct customer *head) struct customer *p; printf(nxianyoukehuxinxiwei:n); p=head; if(head!=NULL) do printf(kefang:%dn,p-num); printf(xingming:%sn,p-name); printf(ruzhushijian:%ld
9、n,p-date); p=p-next; while(p!=NULL); main struct customer *head,*p; int m,number; char c_name20; printf(n); printf( *n); printf( huanyingjinrubinguankefangguanlixitongn); printf( *n); printf( *nn); printf( 1:jiankun); printf( 2:dengjin); printf( 3:tuifangn); printf( 4:chaxunn); printf( *nn); printf(
10、zhixingchaozuo:n); scanf(%d,&m); if(m=1) head=creat; else if(m=2) printf(qingshuruyaodengjidekehuxinxi:); p=(struct customer *)malloc(LEN); scanf(%d %s %ld,&p-num,p-name,&p-date); head=insert(head,p); print(head); else if(m=3) printf(qingshuruyaotuifangkehudejianhao:); scanf(%d,&number); head=del(head,number); print(head); else if(m=4) printf(qingshuruyaochaxunkehudexingming:); scanf(%s,c_name); search(head,c_name); else printf(zhixingchaozuocuowu!);