#include
#include
struct Zongjingli
{
int num;//工号(总经理工号以1开头)
float jibengongz;//基本工资
float jiangjin[12];//奖金
float yeji[12];//业绩
float shuijin[12];//税金
float yingfa[12];//应发
float shifa[12];//实发
};
struct Jingli
{
int num;//工号(经理工号以2开头)
float jibengongz;//基本工资
float jiangjin[12];//奖金
float yeji[12];//业绩
float shuijin[12];//税金
float yingfa[12];//应发
float shifa[12];//实发
};
struct Zhigong
{
int num;//工号(职工工号以3开头)
float jibengongz;//基本工资
float jiangjin[12];//奖金
float yeji[12];//业绩
float shuijin[12];//税金
float yingfa[12];//应发
float shifa[12];//实发
};
/////////////////定义结构体变量////////////////////
struct Zongjingli zjl;
struct Jingli jl[3];
struct Zhigong zg[3][10];
void showmenu();
void shuru();
void xiugai();
void mingxi();
void chaxun();
void jisuangongzi();
void writedata();
void main()
{
int i,j;
zjl.num=1001;
for(i=0;i<3;i++)
{
jl[i].num=2001+i;
for(j=0;j<10;j++)
zg[i][j].num=3001+10*i+j;
}
showmenu();
system("pause");
//writedata();
}
void showmenu()
{
int w;
char select;
do
{
w=0;
printf("按数字键选择相应功能!\n");
printf("1、输入业绩\n2、修改业绩\n3、工资明细\n4、查询明细\n");
scanf("%s",&select);
switch(select)
{
case '1':shuru();break;
case '2':xiugai();break;
case '3':mingxi();break;
case '4':chaxun();break;
default:w=1;printf("输入错误!\n");
}
}while(w);
}
void shuru()
{
int month;//月份
int num;
int i,j;
char a[10];
printf("请输入月份:\n");
scanf("%d",&month);
printf("请输入工号:\n");
scanf("%d",&num);
printf("请输入业绩:\n");
switch(num/1000)
{
case 3:
for(i=0;i<3;i++)
for(j=0;j<10;j++)
if(zg[i][j].num==num)
scanf("%f",&zg[i][j].yeji[month-1]);
break;
}
printf("继续吗?Y继续,N返回\n");
scanf("%s",a);
switch(a[0])
{
case 'y':
case 'Y':shuru();break;
case 'n':
case 'N':showmenu();break;
}
}
void xiugai()
{
int month;//月份
int num;
int i,j;
printf("请输入要修改的工号:\n");
scanf("%d",&num);
printf("请输入要修改的月份:\n");
scanf("%d",&month);
printf("请输入新的业绩:\n");
switch(num/1000)
{
case 3:
for(i=0;i<3;i++)
for(j=0;j<10;j++)
if(zg[i][j].num==num)
scanf("%f",&zg[i][j].yeji[month-1]);
break;
}
}
void jisuangongz()
{
int month,i,j;
float a=0.05,b=0.5,s0=0.0,s1=0.0,s2=0.0,s3=0.0;
zjl.jibengongz=10000;
for(i=0;i<3;i++)
jl[i].jibengongz=5000;
for(i=0;i<3;i++)
for(j=0;j<10;j++)
zg[i][j].jibengongz=2000;
for(month=1;month<=12;month++)
{
for(i=0;i<3;i++)
for(j=0;j<10;j++)
{
zg[i][j].jiangjin[month-1]=zg[i][j].yeji[month-1];
zg[i][j].yingfa[month-1]=zg[i][j].jibengongz+zg[i][j].jiangjin[month-1];
zg[i][j].shuijin[month-1]=zg[i][j].yingfa[month-1]*a;
zg[i][j].shifa[month-1]=zg[i][j].yingfa[month-1]-zg[i][j].shuijin[month-1];
}
}
for(j=0;j<10;j++)
{
s0=s0+zg[0][j].yeji[month-1];
s1=s1+zg[1][j].yeji[month-1];
s2=s2+zg[2][j].yeji[month-1];
}
jl[0].jiangjin[month-1]=s0;
jl[1].jiangjin[month-1]=s1;
jl[2].jiangjin[month-1]=s2;
for(i=0;i<3;i++)
{
jl[i].yingfa[month-1]=jl[i].jibengongz+jl[i].jiangjin[month-1];
jl[i].shuijin[month-1]=jl[i].yingfa[month-1]*a;
jl[i].shifa[month-1]=jl[i].yingfa[month-1]-jl[i].shuijin[month-1];
}
for(i=0;i<3;i++)
s3=s3+jl[i].yeji[month-1];
zjl.jiangjin[month-1]=s1*b;
zjl.yingfa[month-1]=zjl.jibengongz+zjl.jiangjin[month-1];
zjl.shuijin[month-1]=zjl.yingfa[month-1]*a;
zjl.shifa[month-1]=zjl.yingfa[month-1]-zjl.shuijin[month-1];
}
void mingxi()
{
jisuangongz();
printf("所有职工工资明细:\n");
int num,month;
int i,j;
for(month=0;month<12;month++)
{
for(num=1001;num<=1001;num++)
printf("职工号:%d\n",num);
if(zjl.num==num)
{
printf("%d月基本工资:%f\n",month+1,zjl.jibengongz);
printf("%d月奖金:%f\n",month+1,zjl.jiangjin[month]);
printf("%d月业绩:%f\n",month+1,zjl.yeji[month]);
printf("%d月税金:%f\n",month+1,zjl.shuijin[month]);
printf("%d月实发工资:%f\n",month+1,zjl.shifa[month]);
}
for(num=2001;num<=2003;num++)
{ printf("职工号:%d\n",num);
for(i=0;i<3;i++)
if(jl[i].num==num)
{
printf("%d月基本工资:%f\n",month+1,jl[i].jibengongz);
printf("%d月奖金:%f\n",month+1,jl[i].jiangjin[month]);
printf("%d月业绩:%f\n",month+1,jl[i].yeji[month]);
printf("%d月税金:%f\n",month+1,jl[i].shuijin[month]);
printf("%d月实发工资:%f\n",month+1,jl[i].shifa[month]);
}
}
for(num=3001;num<=3030;num++)
{
printf("职工号:%d\n",num);
for(i=1;i<=3;i++)
for(j=0;j<10;j++)
if(zg[i][j].num==num)
{
printf("%d月基本工资:%f\n",month+1,zg[i][j].jibengongz);
printf("%d月奖金:%f\n",month+1,zg[i][j].jiangjin[month]);
printf("%d月业绩:%f\n",month+1,zg[i][j].yeji[month]);
printf("%d月税金:%f\n",month+1,zg[i][j].shuijin[month]);
printf("%d月实发工资:%f\n",month+1,zg[i][j].shifa[month]);
}
}
}
}
void chaxun()
{
jisuangongz();
int month;//月份
int num;
int i,j;
printf("请输入要查询的月份:\n");
scanf("%d",&month);
printf("请输入要查询的工号:\n");
scanf("%d",&num);
for(i=0;i<3;i++)
for(j=0;j<10;j++)
if(zg[i][j].num==num)
{
printf("%d月基本工资:%f\n",month+1,zg[i][j].jibengongz);
printf("%d月奖金:%f\n",month+1,zg[i][j].jiangjin[month]);
printf("%d月业绩:%f\n",month+1,zg[i][j].yeji[month]);
printf("%d月税金:%f\n",month+1,zg[i][j].shuijin[month]);
printf("%d月实发工资:%f\n",month+1,zg[i][j].shifa[month]);
}
}
你自己改下吧