📄 工资管理系统.txt
字号:
pb=pa->p2;
while(pb!=NULL)
{
printf("\nPlease input the name of employee:\n");
scanf("%s",emname);
if(!strcmp(emname,pb->name))
{
pc=pb->p4;
while(pc!=NULL)
{
printf("\nPlease input the name of month\n");
scanf("%s",month1);
if(!strcmp(month1,pc->month))
{
pd=pc->p6;
while(pd!=NULL)
{
printf("\nPlease input the reason:\n");
scanf("%s",reason1);
if(!strcmp(reason1,pd->reason))
{
printf("\nPlease input the reason:");
scanf("%s",pd->reason);
printf("\nPlease input the amount:");
scanf("%f",&pd->amount);
break;
}
else pd=pd->p;
}
break;
}
else pc=pc->p5;
}
break;
}
else pb=pb->p3;
}
break;
}
else pa=pa->p1;
}
printf("\nContinue or not?[n or y](change award)\n");
scanf("%1s",&ch);
if(ch=='n'||ch=='N')
flag=0;
else flag=1;
}
return (head);
}
struct department *dep(struct department *ph) /*插入一个部门*/
{
struct department *head,*pa;
struct employee *pb;
struct salary *pc;
struct award *pd;
short c,flag=1;
char ch;
long n;
head=ph;
while(flag)
{
printf("\nPlease input information of new department!\n");
pa=malloc(sizeof(struct department));
pa->p1=head->p1;
head=pa;
printf("\nPlease input Name of department:\n");
scanf("%s%ld",pa->name);
printf("\nPlease input Number of workers in this department:\n");
scanf("%ld",&pa->num1);
pa->p2=NULL;
for(n=0;n<pa->num1;n++)
{
printf("\nInput information of workers in department %s.\n",pa->name);
pb=malloc(sizeof(struct employee));
pb->p3=pa->p2;
pa->p2=pb;
printf("\nPlease input Name of worker:");
scanf("%s",pb->name);
printf("\nPlease input ID of worker:");
scanf("%s",pb->ID);
printf("\nPlease input telephone number of worker:");
scanf("%s",pb->tel);
printf("\nPlease input mobile number of worker:");
scanf("%s",pb->mobile);
printf("\nPlease input title of worker (jishuzhicheng):");
scanf("%s",pb->jszc);
printf("\nPlease input :\n"
"Gongzikahao,Sex,Age,Standing(Gongling),Zhichengbianhao,Number of months\n");
scanf("%ld,%c,%hd,%hd,%hd",&pb->gzkh,&pb->sex,&pb->age,&pb->standing,&pb->zcbh,&pb->num2);
}
pb=pa->p2;
while(pb!=NULL)
{
pb->p4=NULL;
for(n=0;n<pb->num2;n++)
{
printf("\nInput information of salary of worker %s.\n",pb->name);
pc=malloc(sizeof(struct salary));
pc->p5=pb->p4;
pb->p4=pc;
printf("\nPlease input the month:");
scanf("%s",pc->month);
printf("\nPlease input the title of the worker:");
scanf("%s",pc->title);
printf("\nPlease input:\n"
"zhichengbianhao,Jibengongzi,Zhiwug ongzi,Subsidy(buzhu),Number of award:\n");
scanf("%hd,%f,%f,% f",&pc->zcbh,&pc->jbgz,&pc->zwgz,&pc->subsidy,&pc->num3);
}
pb=pb->p3;
}
pb=pa->p2;
while(pb!=NULL)
{
pc=pb->p4;
while(pc!=NULL)
{
pc->p6=NULL;
for(n=0;n<pc->num3;n++)
{
printf("\nInput information of award of month %s.\n",pc->month);
pd=malloc(sizeof(struct award));
pd->p=pc->p6;
pc->p6=pd;
printf("\nPlease input Reason:\n");
scanf("%s",pd->reason);
printf("\nPlease input Amount:\n");
scanf("%f",&pd->amount);
}
pc=pc->p5;
}
pb=pb->p3;
}
printf("\nContinue or not?[n or y](insert department)\n");
scanf("%1s",&ch);
if(ch=='n'||ch=='N') flag=0;
else flag=1;
}
return(head);
}
struct department *emp(struct department *ph) /*插入一个工人*/
{
struct department *head,*pa;
struct employee *pb;
struct salary *pc;
struct award *pd;
short flag=1;
char ch,dename[24];
long n;
head=ph;
while(flag)
{
pa=head;
printf("\nPlease input name of department that you want to insert workers:\n");
scanf("%s",dename);
while(pa!=NULL)
{
if(!strcmp(dename,pa->name))
{
(pa->num1)++;
pb=malloc(sizeof(struct employee));
pb->p3=(pa->p2)->p3;
pb=pa->p2;
printf("\nPlease input Name of worker:");
scanf("%s",pb->name);
printf("\nPlease input ID of worker:");
scanf("%s",pb->ID);
printf("\nPlease input telephone number of worker:");
scanf("%s",pb->tel);
printf("\nPlease input mobile number of worker:");
scanf("%s",pb->mobile);
printf("\nPlease input title of worker (jishuzhicheng):");
scanf("%s",pb->jszc);
printf("\nPlease input :\n"
"Gongzikahao,Sex,Age,Standing(Gongling),Zhichengbianhao,Number of months\n");
scanf("%ld,%c,%hd,%hd,%hd",&pb->gzkh,&pb->sex,&pb->age,&pb->standing,&pb->zcbh,&pb->num2);
pb->p4=NULL;
for(n=0;n<pb->num2;n++)
{
printf("\nInput information of salary of worker %s.\n",pb->name);
pc=malloc(sizeof(struct salary));
pc->p5=pb->p4;
pb->p4=pc;
printf("\nPlease input the month:");
scanf("%s",pc->month);
printf("\nPlease input the title of the worker:");
scanf("%s",pc->title);
printf("\nPlease input:\n"
"zhichengbianhao,Jibengongzi,Zhiwug ongzi,Subsidy(buzhu),Number of award:\n");
scanf("%hd,%f,%f,% f",&pc->zcbh,&pc->jbgz,&pc->zwgz,&pc->subsidy,&pc->num3);
}
pc=pb->p4;
while(pc!=NULL)
{
pc->p6=NULL;
for(n=0;n<pc->num3;n++)
{
printf("\nInput information of award of month %s.\n",pc->month);
pd=malloc(sizeof(struct award));
pd->p=pc->p6;
pc->p6=pd;
printf("\nPlease input Reason:\n");
scanf("%s",pd->reason);
printf("\nPlease input Amount:\n");
scanf("%f",&pd->amount);
}
pc=pc->p5;
}
break;
}
else pa=pa->p1;
}
printf("\nContinue or not?[n or y](insert workers)\n");
scanf("%1s",&ch);
if(ch=='n'||ch=='N') flag=0;
else flag=1;
}
return(head);
}
struct department *sal(struct department *ph) /*插入一个月的工资*/
{
struct department *head,*pa;
struct employee *pb;
struct salary *pc;
struct award *pd;
char ch,dename[24],emname[30];
short flag=1;
long n;
head=ph;
while(flag)
{
pa=head;
printf("\nPlease input name of department!\n");
scanf("%s",dename);
while(pa!=NULL)
{
if(!strcmp(dename,pa->name))
{
printf("\nPlease input name of worker!\n");
scanf("%s",emname);
pb=pa->p2;
while(pb!=NULL)
{
if(!strcmp(emname,pb->name))
{
(pb->num2)++;
printf("\nPlease input information of salary!\n");
pc=malloc(sizeof(struct employee));
pc->p5=pb->p4;
pb->p4=pc;
printf("\nPlease input the month:");
scanf("%s",pc->month);
printf("\nPlease input the title of the worker:");
scanf("%s",pc->title);
printf("\nPlease input:\n"
"zhichengbianhao,Jibengongzi,Zhiwug ongzi,Subsidy(buzhu),Number of award:\n");
scanf("%hd,%f,%f,% f",&pc->zcbh,&pc->jbgz,&pc->zwgz,&pc->subsidy,&pc->num3);
pc->p6=NULL;
for(n=0;n<pc->num3;n++)
{
printf("\nInput information of award of month %s.\n",pc->month);
pd=malloc(sizeof(struct award));
pd->p=pc->p6;
pc->p6=pd;
printf("\nPlease input Reason:\n");
scanf("%s",pd->reason);
printf("\nPlease input Amount:\n");
scanf("%f",&pd->amount);
}
break;
}
else pb=pb->p3;
}
break;
}
else pa=pa->p1;
}
printf("\nContinue or not?[n or y](insert salary)\n");
scanf("%1s",&ch);
if(ch=='n'||ch=='N') flag=0;
else flag=1;
}
return(head);
}
struct department *awa(struct department *ph) /*插入一类奖金*/
{
struct department *head,*pa;
struct employee *pb;
struct salary *pc;
struct award *pd;
char ch,dename[24],emname[30],month1[10];
short flag=1;
long n;
head=ph;
while(flag)
{
pa=head;
printf("\nPlease input name of department!\n");
scanf("%s",dename);
while(pa!=NULL)
{
if(!strcmp(dename,pa->name))
{
printf("\nPlease input name of worker!\n");
scanf("%s",emname);
pb=pa->p2;
while(pb!=NULL)
{
if(!strcmp(emname,pb->name))
{
printf("\nPlease input the month!\n");
scanf("%s",month1);
pc=pb->p4;
while(pc!=NULL)
{
if(strcmp(month1,pc->month))
{
(pc->num3)++;
printf("\nPlease input information of new award!\n");
pd=malloc(sizeof(struct award));
pd->p=pc->p6;
pc->p6=pd;
printf("\nPlease input Reason:\n");
scanf("%s",pd->reason);
printf("\nPlease input Amount:\n");
scanf("%f",&pd->amount);
break;
}
else pc=pc->p5;
}
break;
}
else pb=pb->p3;
}
break;
}
else pa=pa->p1;
}
printf("\nContinue or not?[n or y](insert salary)\n");
scanf("%1s",&ch);
if(ch=='n'||ch=='N') flag=0;
else flag=1;
}
return(head);
}
struct department *depa(struct department *ph) /*删除一个部门*/
{
struct department *pa,*head,*lasta;
char ch,dename[24];
short flag=1;
head=ph;
while(flag)
{
pa=head;
printf("\nPlease input name of department to delete:\n");
scanf("%s",dename);
while(pa!=NULL&&strcmp(dename,pa->name))
{
lasta=pa;
pa=pa->p1;
}
if(!strcmp(dename,pa->name))
{
if(pa==head)
head=pa->p1;
else lasta->p1=pa->p1;
free(pa);
}
printf("\nContinue or not?[n or y](delete department)\n");
scanf("%1s",&ch);
if(ch=='n'||ch=='N') flag=0;
else flag=1;
}
return(head);
}
struct department *empl(struct department *ph) /*删除一个工人*/
{
struct department *head,*pa;
struct employee *pb,*lastb;
char ch,dename[24],emname[30];
short flag=1;
head=ph;
pa=head;
while(flag)
{
pa=head;
while(pa!=NULL)
{
printf("\nPlease input name of department!\n");
scanf("%s",dename);
if(!strcmp(dename,pa->name))
{
printf("\nPlease input name of worker!\n");
scanf("%s",emname);
pb=pa->p2;
while(pb!=NULL&&strcmp(emname,pb->name))
{
lastb=pb;
pb=pb->p3;
}
if(!strcmp(emname,pb->name))
{
if(pb==pa->p2)
pa->p2=pb->p3;
else lastb->p3=pb->p3;
}
free(pb);
break;
}
else pa=pa->p1;
}
printf("\nContinue or not?[n or y](delete employee)\n");
scanf("%1s",&ch);
if(ch=='n'||ch=='N') flag=0;
else flag=1;
}
return(head);
}
struct department *sala(struct department *ph) /*删除一个月的工资*/
{
struct department *head,*pa;
struct employee *pb;
struct salary *pc,*lastc;
char ch,dename[24],emname[30],month1[10];
short flag=1;
head=ph;
while(flag)
{
pa=head;
while(pa!=NULL)
{
printf("\nPlease input name of department!\n");
scanf("%s",dename);
if(!strcmp(dename,pa->name))
{
pb=pa->p2;
while(pb!=NULL)
{
printf("\nPlease input name of worker!\n");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -