超市员工管理系统_第1页
超市员工管理系统_第2页
超市员工管理系统_第3页
超市员工管理系统_第4页
超市员工管理系统_第5页
已阅读5页,还剩10页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

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-next=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 ,pnam

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论