资源描述
#include #include#include#include#define null 0typedef struct Info1char num10;char name10;char depar10;char yfsalary10;char aband10;char tax10;char sfsalary10;struct Info1 *next;Info2;typedef struct Info1 *Info;Info head;void display();void find();void modify();void add();void del();void list();void listOne(Info s);Info isExists(char *num);void init();void init()head=(Info)malloc(sizeof(Info2);head-next=null;void main()init();while(1)char c;display();scanf(%c,&c);switch(c) case 1:find();break; case 2:add();break;case 3:modify();break;case 4:del();break;case 5:list();break;case 6:printf(tt.退出系统!n);return;default: printf(tt输入错误!请按任意键返回重新选择(1-7)n);getchar();void display()printf(nt* 欢迎使用员工信息管理系统 *nn);printf(t请选(1-7):n);printf(t=n);printf(tt1.查询员工信息n);printf(tt2.录入员工信息n);printf(tt3.修改员工信息n);printf(tt4.删除员工信息n);printf(tt6.显示所有员工信息n);printf(tt7.退出系统n);printf(t=n);printf(t您的选择是: );void listOne(Info p)printf(n该员工信息记录如下: );printf(n=nn);printf(%-12s%-10s%-10s%-7s%-7s%-10s%-10s%n,员工编号,姓名,部门,应付工资,保险,税金,实付工资);printf(%-12s%-10s%-10s%-7s%-7s%-10s%-10s%n,p-num,p-name,p-depar,p-yfsalary,p-aband,p-tax,p-sfsalary);Info isExists(char *num)Info p,q;p=head;q=p-next;while(q!=null)if(strcmp(q-num,num)=0)return p;p=q;q=p-next;return p;void add()Info p,q;char num10;q=(Info)malloc(sizeof(Info2);printf(tt请输入员工编号: );scanf(%s,num);p=isExists(num);if (p-next=null)strcpy(q-num,num);printf(tt请输入员工姓名: );scanf(%s,q-name);printf(tt请输入该员工的部门: );scanf(%s,q-depar);printf(tt请输入该员工的应付工资金额: );scanf(%s, q-yfsalary);printf(tt请输入该员工的保险金额: );scanf(%s, q-aband);printf(tt请输入该员工的税金金额: );scanf(%s,q-tax);printf(tt请输入该员工的实付工资: );scanf(%s,q-sfsalary);q-next=null;p-next=q;elseprintf(ntt您所输入的员工编号以存在! );printf(ntt按任意键返回住菜单.);getchar();void del()Info p,q;char num10;if (head-next=null)printf(ntt当前还没有员工信息记录,按任意键返回主菜单.);getchar();return;printf(tt请输入员工编号: );scanf(%s,num);p=isExists(num);q=p-next;if (q!=null)q=q-next;p-next=q;printf(ntt删除成功! );elseprintf(ntt您所输入的员工编号有误或不存在! );printf(ntt按任意键返回主菜单.);getchar();void modify()Info p,q;char num10;if (head-next=null)printf(ntt当前还没有员工信息记录,按任意键返回主菜单.);getchar();return;printf(tt请输入员工编号: );scanf(%s,num);p=isExists(num);q=p-next;if(q!=null)listOne(q);printf(tt请输入该员工的新姓名: );scanf(%s,q-name);printf(tt请输入该员工的部门: );scanf(%s,q-depar);printf(tt请输入该员工的应付工资金额: );scanf(%s,q-yfsalary);printf(tt请输入该员工的保险: );scanf(%s,q-aband);printf(tt请输入该员工的新税金金额: );scanf(%s,q-tax);printf(tt请输入该员工的新实付工资: );scanf(%s,q-sfsalary);elseprintf(ntt您所输入的员工编号有误或不存在!);printf(ntt按任意键返回主菜单.);getchar();void list()Info p;if (head-next=null)printf(ntt当前还没有员工信息记录,按任意键返回主菜单.);getchar();return;printf(n所有员工信息记录如下: );printf(n=nn);printf(%-12s%-10s%-10s%-7s%-7s%-10s%-10s%n,员工编号,姓名,部门,应付工资,保险,税金,实付金额);p=head-next;while(p!=null)printf(%-12s%-10s%-10s%-7s%-7s%-10s%-10s%n,p-num,p-name,p-depar,p-yfsalary,p-aband,p-tax,p-sfsalary);p=p-next;printf(ntt按任意键返回主菜单.);getchar();void find()Info p;char num10;if (head-next=null)printf(ntt当前还没有员工信息记录,按任意键返回主菜单.);getchar();return;printf(tt输入员工编号: );scanf(%s,num);p=isExists(num);p=p-next;if(p!=null)listOne(p);elseprintf(ntt您所输入的员工信息有误或不存在!);printf(ntt按任意键返回主菜单.);getchar();
展开阅读全文