⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 工资管理系统.txt

📁 用C实现简单的工资管理系统
💻 TXT
📖 第 1 页 / 共 4 页
字号:
					scanf("%s",emname);
					if(!strcmp(emname,pb->name))
					{
						printf("\nPlease input the month!\n");
						scanf("%s",month1);
						pc=pb->p4;
						while(pc!=NULL&&strcmp(month1,pc->month))
						{
							lastc=pc;
							pc=pc->p5;
						}
						if(!strcmp(month1,pc->month))
						{
							if(pc==pb->p4)
							(pb->p4)=pc->p5;
							else lastc->p5=pc->p5;
						}
						free(pc);
						break;
					}
					else pb=pb->p3;
				}
				break;
			}
			else pa=pa->p1;
		}
		printf("\nContinue or not?[n or y](delete salary)\n");
		scanf("%1s",&ch);
		if(ch=='n'||ch=='N')  flag=0;
		else flag=1;
	}
	return(head);
}

struct department *awar(struct department *ph)                /*删除一类奖金*/
{
	struct department *head,*pa;
	struct employee *pb;
	struct salary *pc;
	struct award *pd,*lastd;
	char ch,dename[24],emname[30],month1[10],reason1[20];
	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");
					scanf("%s",emname);
					if(!strcmp(emname,pb->name))
					{
						pc=pb->p4;
						while(pc!=NULL)
						{
						    printf("\nPlease input the month!\n");
						    scanf("%s",month1);
						    if(!strcmp(month1,pc->month))
						    {
						    	printf("\nPlease input the reason!\n");
						    	scanf("%s",reason1);
						    	pd=pc->p6;
						    	while(pd!=NULL&&strcmp(month1,pd->reason))
						    	{
						    		lastd=pd;
						    		pd=pd->p;
						    	}
						    	if(!strcmp(month1,pd->reason))
						    	{
						    		if(pd==pc->p6)
						    		pc->p6=pd->p;
						    		else lastd->p=pd->p;
						    	}
						    	free(pd);
						    	break;
						    }
						    pc=pc->p5;
					    }
					    break;
					}
					else pb=pb->p3;
				}
				break;
			}
			else pa=pa->p1;
		}
		printf("\nContinue or not?[n or y](delete salary):\n");
		scanf("%1s",&ch);
		if(ch=='n'||ch=='N')  flag=0;
		else flag=1;
	}
	return(head);
}
void zhch(struct department *ph)            /*按职称查询*/
{
	struct department  *pa,*head;
	struct employee   *pb;
	struct salary  *pc;
	char zhicheng[20],ch;
	short flag=1;
	long  i=0;
	
	head=ph;
	while(flag)
	{
	    printf("\nPlease input the title you want to check!\n");
	    scanf("%s",zhicheng);
	    pa=head;
	    while(pa!=NULL)
	    {
	    	pb=pa->p2;
	    	while(pb!=NULL)
	    	{
	    		pc=pb->p4;
	    		if(!strcmp(pc->title,zhicheng))
	    		{
	    			i++;
	    			printf("\nInformation of worker!\n");
	    			printf("\nName   Gongzikahao    ID     Sex   Age   Gongling\n");
	    			printf("%s\t%ld\t%s\t%c\t%hd\t%hd\n",pb->name,pb->gzkh,pb->ID,pb->sex,pb->age,pb->standing);
	    			printf("%s\t%s\t%s\t%hd\n",pb->tel,pb->mobile,pb->jszc,pb->zcbh);
	    			printf("\nSalary  information  of the worker!\n");
	    			printf("Month   Zhichengbianhao  Zhicheng  Jibengongzi   Zhiwugongzi  Subsidy\n");
	    			while(pc!=NULL)
	    			{
	    				printf("%s\t%hd\t%s\t%f\t%f\t%f\n",pc->month,pc->zcbh,pc->title,pc->jbgz,pc->zwgz,pc->subsidy);
	    				pc=pc->p5;
	    			}
	    		}
	    		pb=pb->p3;
	    	}
	    	pa=pa->p1;
	    }
	    printf("\nContinue or not?[n or y](query title)\n");
		scanf("%1s",&ch);
		if(ch=='n'||ch=='N')  flag=0;
		else flag=1;
	}
	printf("\nThe total number is %ld",i);
}

void gongzi(struct department *ph)                   /*按工资的查询*/
{
	float  gongzi;
	struct department *head,*pa;
	struct employee  *pb;
	struct salary  *pc;
	short flag=1;
	char ch;
	long i=0;
	
	head=ph;
	pa=head;
	while(flag)
	{
		printf("\nPlease input the minimum salary!\n");
		scanf("%f",&gongzi);
		while(pa!=NULL)
		{
			pb=pa->p2;
			while(pb!=NULL)
			{
				pc=pb->p4;
				if(pc->jbgz>=gongzi)
				{
					i++;
					printf("\nInformation of worker!\n");
	    			printf("\nName   Gongzikahao    ID     Sex   Age   Gongling\n");
	    			printf("%s\t%ld\t%s\t%c\t%hd\t%hd\n",pb->name,pb->gzkh,pb->ID,pb->sex,pb->age,pb->standing);
	    			printf("%s\t%s\t%s\t%hd\n",pb->tel,pb->mobile,pb->jszc,pb->zcbh);
	    			printf("\nSalary  information  of the worker!\n");
	    			printf("Month   Zhichengbianhao  Zhicheng  Jibengongzi   Zhiwugongzi  Subsidy\n");
	    			while(pc!=NULL)
	    			{
	    				printf("%s\t%hd\t%s\t%f\t%f\t%f\n",pc->month,pc->zcbh,pc->title,pc->jbgz,pc->zwgz,pc->subsidy);
	    				pc=pc->p5;
	    			}
				}
				pb=pb->p3;
			}
			pa=pa->p1;
		}
	    printf("\nContinue or not?[n or y](query salary)\n");
		scanf("%1s",&ch);
		if(ch=='n'||ch=='N')  flag=0;
		else flag=1;
	}
	printf("\nThe total number is %ld",i);
}

void worker(struct department *ph)                /*查询某个工人*/
{
	struct department *head,*pa;
	struct employee  *pb;
	struct salary *pc;
	struct award *pd;
	char ch,emname[30],dename[24],month1[10];
	short flag=1;
	float  yfgz,tax,sfgz,shuifei,dianfei,jiangjin=0;
	
	head=ph;
	pa=head;
	while(flag)
	{
		printf("\nPlease input the name of department of the worker!\n");
		scanf("%s",dename);
		printf("\nPlease input the name of the worker!\n");
		scanf("%s",emname);
		while(pa!=NULL)
		{
			if(!strcmp(pa->name,dename))
			{
			    pb=pa->p2;
			    while(pb!=NULL)
			    {
			    	printf("\nPlease input the month:\n");
			    	scanf("%s",month1);
			    	pc=pb->p4;
			    	if(strcmp(pb->name,emname))
			    	{
			    	    printf("\nInformation of worker!\n");
	    			    printf("\nName   Gongzikahao    ID     Sex   Age   Gongling\n");
	    			    printf("%s\t%ld\t%s\t%c\t%hd\t%hd\n",pb->name,pb->gzkh,pb->ID,pb->sex,pb->age,pb->standing);
	    			    printf("%s\t%s\t%s\t%hd\n",pb->tel,pb->mobile,pb->jszc,pb->zcbh);
	    	    		printf("\nSalary  information  of the worker!\n");
	    	    		printf("Month   Zhichengbianhao  Zhicheng  Jibengongzi   Zhiwugongzi  Subsidy\n");
	    	    		while(pc!=NULL)
	    	    		{
	    		    		printf("%s\t%hd\t%s\t%f\t%f\t%f\n",pc->month,pc->zcbh,pc->title,pc->jbgz,pc->zwgz,pc->subsidy);
	    	    			pc=pc->p5;
	    		    	}
	    		    	pc=pb->p4;
	    		    	while(pc!=NULL)
	    		    	{
	    		    		if(!strcmp(pc->month,month1))
	    		    		{
	    		    			pd=pc->p6;
	    		    			while(pd!=NULL)
	    		    			{
	    		    				jiangjin+=pd->amount;
	    		    				pd=pd->p;
	    		    			}
	    		    			printf("\nPlease input shuifei and dianfei of worker %s\n",pb->name);
	    		    			scanf("%f%f",&shuifei,&dianfei);
	    		    			yfgz=pc->jbgz+pc->zwgz+pc->subsidy;
	    		    			if(yfgz<=800)  tax=0;
	    		    			if(yfgz>800&yfgz<=1400)   tax=(yfgz-800)*0.05;
	    		    			if(yfgz>1400)  tax=(yfgz-1400)*0.1;
	    		    			sfgz=yfgz-tax-dianfei-shuifei-15+jiangjin;
	    		    			printf("\ngong ren %s de gong zi dan shu ju:\n",pb->name);
	    		    			printf("Gongzikahao    Name    Yingfagongzi   dianfei  shuifei    qingjie\n");
	    		    			printf("%ld\t%s\t%f\t%f\t%f\t%f\n",pb->gzkh,pb->name,yfgz,dianfei,shuifei,5);
	    		    			printf("biludianshi  shuijin  shifagongzi  jiangli\n");
	    		    			printf("%f\t%f\t%f\t%f",10,tax,sfgz,jiangjin);
	    		    		}
	    		    		pc=pc->p5;
	    		    	}
	    		    	break;
			    	}
			    	pb=pb->p3;
			    }
			    break;
			}
			pa=pa->p1;
		}
	    printf("\nContinue or not?[n or y](query worker)\n");
		scanf("%1s",&ch);
		if(ch=='n'||ch=='N')  flag=0;
		else flag=1;
	}
}

void stage(struct department *ph)                 /*按年龄统计*/
{
	struct department *head,*pa;
	struct employee *pb;
	struct salary *pc;
	struct award  *pd;
	long  young=0,middle=0,old=0;
	
	head=ph;
	pa=head;
	while(pa!=NULL)
	{
		pb=pa->p2;
		while(pb!=NULL)
		{
			if(pb->age<=20)  young++;
			if(pb->age>=20&&pb->age<=50)  middle++;
			if(pb->age>=50)    old++;
			pb=pb->p3;
		}
		pa=pa->p1;
	}
	printf("\nThe number of worker who's young than 20 is:%ld.\n",young);
	printf("The number of worker who's old than 20 and less than 50 is:%ld.\n",middle);
	printf("The number of worker who's old than 50 is:%ld.\n",old);
}

void stsalary(struct department *ph)                    /*按工资统计*/
{
	struct department *head,*pa;
	struct employee *pb;
	struct salary  *pc;
	char jszc1[20]="worker",jszc2[20]="technician",jszc3[20]="engineer",month1[10];
	double  tjbgz1=0,tzwgz1=0,tsubsidy1=0,tyfgz1=0,tgz=0;
	double  tjbgz2=0,tzwgz2=0,tsubsidy2=0,tyfgz2=0;
	double  tjbgz3=0,tzwgz3=0,tsubsidy3=0,tyfgz3=0;
	double  gz1=0,gz2=0,gz3=0;
	long    tnum1=0,tnum2=0,tnum3=0;
	
	head=ph;
	pa=head;
	printf("\nstatistics of all kinds of salary\n");
	printf("\nPlease input the month you want to check:\n");
	scanf("%s",month1);
	while(pa!=NULL)
	{
		pb=pa->p2;
		while(pb!=NULL)
		{
			pc=pb->p4;
			while(pc!=NULL)
			{
				if(!strcmp(pc->month,month1))
				{
					if(!strcmp(pc->title,jszc1)) 
					{
						tjbgz1+=(double)pc->jbgz;
						tzwgz1+=(double)pc->zwgz;
						tsubsidy1+=(double)pc->subsidy;
						tnum1++;
					}
					if(!strcmp(pc->title,jszc2)) 
					{
						tjbgz2+=(double)pc->jbgz;
						tzwgz2+=(double)pc->zwgz;
						tsubsidy2+=(double)pc->subsidy;
						tnum2++;
					}
					if(!strcmp(pc->title,jszc3)) 
					{
						tjbgz3+=(double)pc->jbgz;
						tzwgz3+=(double)pc->zwgz;
						tsubsidy3+=(double)pc->subsidy;
						tnum3++;
					}
				}
				pc=pc->p5;
			}
			pb=pb->p3;
		}
		pa=pa->p1;
	}
	tyfgz1=tjbgz1+tzwgz1+tsubsidy1;
	tyfgz2=tjbgz2+tzwgz2+tsubsidy2;
	tyfgz3=tjbgz3+tzwgz3+tsubsidy3;
	tgz=tyfgz1+tyfgz2+tyfgz3;
	printf("\nThe statistics of title worker\n"
	"Jibengongzi    Zhiwugongzi    Subsidy     Yifagongzi\n");
	printf("%Lf\t%Lf\t%Lf\t%Lf",tjbgz1,tzwgz1,tsubsidy1,tyfgz1);
	printf("\nThe statistics of title technician\n"
	"Jibengongzi    Zhiwugongzi    Subsidy     Yifagongzi\n");
	printf("%Lf\t%Lf\t%Lf\t%Lf",tjbgz2,tzwgz2,tsubsidy2,tyfgz2);
	printf("\nThe statistics of title engineer\n"
	"Jibengongzi    Zhiwugongzi    Subsidy     Yifagongzi\n");
	printf("%Lf\t%Lf\t%Lf\t%Lf",tjbgz3,tzwgz3,tsubsidy3,tyfgz3);
	tgz=tyfgz1+tyfgz2+tyfgz3;
	printf("\nThe total number of salary in this company is:%Lf.\n",tgz);
	gz1=tyfgz1/(double)tnum1;
	gz2=tyfgz2/(double)tnum2;
	gz3=tyfgz3/(double)tnum3;
	printf("zhicheng wei worker de pingjungongzi:%Lf\n",gz1);	
	printf("zhicheng wei technician de pingjungongzi:%Lf\n",gz2);
	printf("zhicheng wei engineer de pingjungongzi:%Lf\n",gz3);
	
}

void stpaixu(struct department *ph)                  /*对工人按工资排序*/
{
	struct department *head,*pa;
	struct employee  *pb,*current,*last,*headb;
	struct salary  *pc;
	float  yfgz,yfgz1;
	
	head=ph;
	pa=head;
	headb=NULL;
	while(pa!=NULL)
	{
		pb=pa->p2;
		while(pb!=NULL)
		{
			if(headb==NULL)
			{
				pb->p3=headb;
				headb=pb;
			}
			else 
			{
				current=headb;
				yfgz1=(current->p4)->jbgz+(current->p4)->zwgz+(current->p4)->subsidy;
				yfgz=(pb->p4)->jbgz+(pb->p4)->zwgz+(pb->p4)->subsidy;
				while(yfgz<yfgz1&&current->p3!=NULL)
				{
					last=current;
					current=current->p3;
					yfgz1=(current->p4)->jbgz+(current->p4)->zwgz+(current->p4)->subsidy;
				}
				if(yfgz>=yfgz1)
				    if(current==headb)
				    {
				    	pb->p3=headb;
				    	headb=pb;
				    }
				    else 
				    {
				    	pb->p3=current;
				    	last->p3=pb;
				    }
				else 
				{
					pb->p3=NULL;
					last->p3=pb;
				}    
			}
			pb=pb->p3;
		}
		pa=pa->p1;
	}
	pb=headb;
	while(pb!=NULL)
	{
		printf("\nThe list of all workers by salary:(from  high  to  low)\n");
		printf("Name    Gongzikahao    ID     Sex    Age   Gongling  \n");
		printf("%s\t%ld\t%s\t%c\t%hd\t%hd\n",pb->name,pb->gzkh,pb->ID,pb->age,pb->standing);
		printf("%s\t%s\t%s\t\n\n",pb->tel,pb->mobile,pb->jszc);
		pb=pb->p3;
	}
}










⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -