超市员工管理系统.doc

上传人:知****量 文档编号:31724700 上传时间:2022-08-08 格式:DOC 页数:15 大小:32.04KB
返回 下载 相关 举报
超市员工管理系统.doc_第1页
第1页 / 共15页
超市员工管理系统.doc_第2页
第2页 / 共15页
点击查看更多>>
资源描述

《超市员工管理系统.doc》由会员分享,可在线阅读,更多相关《超市员工管理系统.doc(15页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。

1、超市员工管理系统#include include stdlib.h include windows.h /清屏函数头文件 include number ); if(!strcmp(p-number ,) free(p); /释放不需要的结构体内存 break; else +i; scanf(%sss%s%ss%s,pname ,psex ,pborth ,p-degree ,pbusiness ,p-phone ,pplace ); p-con0=0; /防止后面判断出现随机值 if(head=NULL) head=p; else while(q-next !=NULL) /防止结束后再次输入

2、时出现问题 q=q-next ; q-next =p; q=p; /每次都加在链表尾 return head; /排序函数 /输入参数:头指针 void Sort(struct Stuff head) char ch; struct Stuff *p,q,r; while(1) printf(”请选择排序条件:1。编号2.姓名3.性别4.出生年月5。学历6.职务7。电话8.地址0.退出n”); scanf(” %c”,ch); if(ch=0) break; if(ch1|ch8) printf(”输入错误,请重新输入!n); continue; p=head; while(p-next!=N

3、ULL) /选择排序 q=pnext; r=p; while(q!=NULL) if(Sel(ch,r,q) /调用判断函数 r=q; q=q-next; if(r!=p) /交换内容 Scpy(r-number,pnumber); Scpy(r-name,p-name); Scpy(rsex,psex); Scpy(rborth,pborth); Scpy(r-degree,p-degree); Scpy(r-business,p-business); Scpy(r-phone,p-phone); Scpy(r-place,p-place); p=p-next; Prf(head); /输出

4、 /交换函数 void Scpy(char *p,char q) char c50; strcpy(c,p); strcpy(p,q); strcpy(q,c); /判断函数 /输出参数:1为真,0为假 int Sel(char ch,struct Stuff p,struct Stuff q) switch(ch) /实现各个关键字查找 case 1: return strcmp(q-number ,p-number )0|strcmp(qcon ,pnumber )=0 ; /排序条件及查找条件 case 2: return strcmp(q-name ,p-name )0|strcmp(

5、q-con ,p-name )=0 ; case 3: return strcmp(qsex ,p-sex )0strcmp(qcon ,psex )=0 ; case 4: return strcmp(q-borth ,p-borth)con ,p-borth )=0 ; case 5: return strcmp(qdegree ,p-degree )business ,p-business )0|strcmp(qcon ,p-business)=0 ; case 7: return strcmp(qphone ,pphone )con ,pphone)=0; case 8: return

6、 strcmp(qplace ,p-place )0|strcmp(q-con ,pplace )=0; default : exit(0); /查找函数 struct Stuff *Ser(struct Stuff head) struct Stuff *p=NULL,q,a=0”,0,0”,0”,”0,0”,0,”0; /防止判断时错误 int flag; /查找判断 char ch,sh; q=&a; while(1) printf(请输入要查找的条件:1.编号2。姓名3。性别4.出生年月5.学历6。职务7。电话8。住址0。退出n); scanf( c,ch); if(ch=0) bre

7、ak; if(ch1|ch8) printf(输入错误,请重新输入!n); continue; fflush(stdin); printf(”请输入:”); gets(q-con ); p=head; /指向表头 flag=0; while(p!=NULL) if(Sel(ch,p,q)) printf(”员工信息如下:n”); printf( 编号 | 姓名 性别 | 出生年月 | 学历 | 职务 | 电话 | 住址 ns s %s %s %s %s %s sn” ,pnumber ,pname ,p-sex ,p-borth ,p-degree ,pbusiness ,p-phone ,p

8、-place ); printf(是否需要:1.更改 2.删除 3。继续n); scanf(” c,sh); if(sh=1) Chn(head,pnumber); /调用更改函数 else if(sh=2) head=Del(head,pnumber); /调用删除函数,得到的head必须return flag=1; break; p=p-next ; if(flag=0) printf(没有找到该员工信息!n); return head; /更改函数 /输入参数:n10 为员工编号 void Chn(struct Stuff *head,char n10) struct Stuff p=h

9、ead; int flag=0; if(head=NULL) printf(”未找到员工信息!n); else while(p!=NULL) if(!strcmp(p-number,n) printf(”请输入新的信息:n编号姓名性别出生年月|学历|职务电话|住址n); scanf(”%s%s%sss%s%ss”,pnumber ,p-name ,p-sex ,p-borth ,p-degree ,pbusiness ,p-phone ,pplace ); printf(员工信息如下:n”); flag+; break; p=pnext; if(flag=0) printf(”未找到该员工信息

10、!n); Prf(head); /删除函数 /输入参数:n为员工编号 /输出参数:头指针 struct Stuff *Del(struct Stuff *head,char n10) struct Stuff *p,pr; int flag; flag=0; p=head,pr=head; if(head=NULL) printf(”未找到员工信息!n”); else while(strcmp(pnumber ,n)&pnext !=NULL) pr=p; p=p-next ; if(!strcmp(p-number ,n) if(p=head) head=pnext ; else pr-ne

11、xt=p-next ; free(p); printf(”删除成功!n”); i; else printf(未找到员工信息!n”); Prf(head); return head; /输出函数 void Prf(struct Stuff head) struct Stuff p=head; int i=1; while(p!=NULL) printf(d。 s s s %s s s s sn ,i+,p-number ,pname ,p-sex ,p-borth ,pdegree ,p-business ,pphone ,pplace); p=p-next ; /释放函数 void Fre(struct Stuff head) struct Stuff *p; while(head!=NULL) p=head; head=headnext ; free(p);

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 应用文书 > 工作计划

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知得利文库网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号-8 |  经营许可证:黑B2-20190332号 |   黑公网安备:91230400333293403D

© 2020-2023 www.deliwenku.com 得利文库. All Rights Reserved 黑龙江转换宝科技有限公司 

黑龙江省互联网违法和不良信息举报
举报电话:0468-3380021 邮箱:hgswwxb@163.com