当前位置:文档之家› 企业职工工资管理系统 附代码

企业职工工资管理系统 附代码

#include <stdio.h>#include <string.h> #include <stdlib.h>#define E 50void Creat();void Creat2();void Creat3();void Chakan();void Chakan2();void Chakan3();void add();void del();void xiugai();void findnum();void findname(); void findname2(); void findshijian(); void gengxin();void findtime();void jisuan();void jisuan2();void jisuan3();void pai();void put();int number;float sum;struct employee{char num[5];char name[10];char sex[3];char shengri[10];char degree[10];int nianxian; } emp[E];struct emp_kao{char num[5];char name[10];char riqi[10];int tianshu;}emp_kaoqin[E];struct emp_gong{char num[5];char name[10];floatzhiwugongzi,zhiwubutie,zhufangbutie,kaoqin,yingfagongzi,yanglaobaoxian,zhufang,shifagongzi; }emp_gongzi[E];void main (){char YN[3];char *Y="Y";char *N="N";int i;int LL;//put();printf(" ********企业职工工资管理系统********\n");kaishi: printf("\n创建文件(请选【1】)\n 操作文件(请选【2】)\n 查看文件(请选【3】)\n 更新文件(请选【4】)\n");scanf("%d",&LL);if(LL==1){Creat();printf("\n创建考勤记录文件??Y/N(注意大写)\n");scanf("%s",&YN);if (strcmp(YN,Y) == 0){Creat2();printf("\n创建工资信息文件??Y/N(注意大写)\n");scanf("%s",&YN);if (strcmp(YN,Y) == 0){Creat3();goto kaishi;}else{goto kaishi;}}else{goto kaishi;}}else if (LL==2){caozuo: printf("增加人事基本信息(请选【1】)\n");printf("删除人事基本信息(请选【2】)\n");printf("修改人事基本信息(请选【3】)\n");printf("查询人事基本信息(请选【4】)\n");printf("输出某月份的职工工资信息(请选【5】)\n");printf("职工工资信息进行统计(请选【6】)\n");printf("退出(请选【7】)\n");scanf("%d",&LL);if (LL==1){add();goto caozuo;}else if (LL==2){shanchu :del();printf(" 是否继续删除??(注意大写)\n");scanf("%s",&YN);if (strcmp(YN,Y) == 0){goto shanchu;}else if (strcmp(YN,N) == 0){goto caozuo;}else{printf("操作错误!!返回->\n");goto caozuo;}}else if (LL==3){xiugai:xiugai();printf(" 是否继续修改??(注意大写)\n");scanf("%s",&YN);if (strcmp(YN,Y) == 0){goto xiugai;}else if (strcmp(YN,N) == 0){goto caozuo;}else{printf("操作错误!!返回->\n");goto caozuo;}}else if (LL==4){chaxun: printf("编号查询(请选【1】)\n 全名查询(请选【2】)\n 姓查询(请选【3】)\n 月份查询(请选【4】)\n 退出(请选【5】)\n\n");scanf("%d",&LL);if (LL==1){findnum();goto chaxun;}if (LL==2){findname();goto chaxun;}if (LL==3){findname2();goto chaxun;}if (LL==4){findtime();goto chaxun;}if(LL==5){goto caozuo;}else{printf("操作错误!!返回->\n");goto caozuo;}}if(LL==5){findshijian();goto caozuo;}if (LL==6){jisuan: printf("职工人数...(请选【1】)\n 平均实发工资(请选【2】)\n低于平均工资(请选【3】)\n 退出(请选【4】)\n");scanf("%d",&LL);if (LL==1){jisuan();goto jisuan;}else if (LL==2){jisuan2();goto jisuan;}else if (LL==3){jisuan3();goto jisuan;}else if (LL==4){goto caozuo;}else{printf("操作错误!!返回->\n");goto jisuan;}}if (LL==7){goto kaishi;}}else if(LL==3){chakan: printf("\n查看基本信息文件(请选【1】)\n查看考勤记录文件(请选【2】)\n查看工资信息文件(请选【3】)\n退出(请选【4】)\n");scanf("%d",&LL);if (LL==1){Chakan();goto chakan;}else if(LL==2){Chakan2();goto chakan;}else if(LL==3){Chakan3();goto chakan;}else if(LL==4){goto kaishi;}else{printf("操作错误!!返回->\n");goto chakan;}}else if (LL==4){gengxin();goto kaishi;}int aa;scanf("%d",&aa);}void Creat(){FILE *fp;int i,j;printf("创建【一】基本信息文件.....\n");printf(" 请您输入创建人数:");scanf("%d",&number);if ((fp = fopen("number.dat", "wb+")) == NULL){printf("Can't open file\n");exit(0);}fwrite(&number,sizeof(int),1,fp);fclose(fp);if ((fp = fopen("employee.dat", "wb+")) == NULL){printf("Can't open file\n");exit(0);}printf(" 编号姓名性别出生日期职称工作年限\n");for (i=0;i<number;i++){j=i+1;printf("->【%d】",j);scanf(" %s %s %s %s %s %d",emp[i].num,emp[i].name,emp[i].sex,emp[i].sh engri,emp[i].degree,&emp[i].nianxian);printf("\n");}pai();fwrite(emp,sizeof(struct employee),number, fp);fclose(fp);if ((fp = fopen("employee.dat", "rb+")) == NULL){printf("Can't open file\n");exit(0);}printf(" 创建成功!!\n");printf(" 编号姓名性别出生日期职称工作年限\n");for (i = 0; fread(&emp[i],sizeof(struct employee),1,fp) == 1 ; i++){printf(" %s %s %s %s %s %d\n",emp[i].num,emp[i].name,emp[i].s ex,emp[i].shengri,emp[i].degree,emp[i].nianxian);}fclose(fp);}void Creat2(){FILE *fp,*fp2;int i,j;printf("创建【二】考勤记录文件.....\n");printf(" 目前需创建人数:%d\n",number);printf(" 编号姓名日期出勤次数\n",number);if ((fp = fopen("employee.dat", "rb")) == NULL){printf("Can't open file\n");exit(0);}fread(emp,sizeof(struct employee),number, fp);if ((fp2 = fopen("emp_kao.dat", "wb")) == NULL){printf("Can't open file\n");exit(0);}for (i=0;i<number;i++){j=i+1;strcpy(emp_kaoqin[i].name, emp[i].name);strcpy(emp_kaoqin[i].num, emp[i].num);printf("->【%d】%s %s",j,emp_kaoqin[i].num,emp_kaoqin[i].name);scanf(" %s %d",emp_kaoqin[i].riqi,&emp_kaoqin[i].tianshu);printf("\n");}fwrite(emp_kaoqin, sizeof(struct emp_kao),number, fp2);fclose(fp);fclose(fp2);if ((fp = fopen("emp_kao.dat", "rb+")) == NULL){printf("Can't open file\n");exit(0);}printf(" 创建成功!!\n");printf(" 编号姓名日期出勤天数\n");for (i = 0; fread(&emp_kaoqin[i],sizeof(struct emp_kao),1,fp) == 1 ; i++){printf(" %s %s %s %d\n",emp_kaoqin[i].num,emp_kaoqin[i].name,emp_ka oqin[i].riqi,emp_kaoqin[i].tianshu);}fclose(fp);}void Creat3(){FILE *fp,*fp2,*fp3;int i,j;char *zhugong="助工";char *gongchengshi="工程师";char *gaojigongchengshi="高级工程师";floatzhiwugongzi,zhiwubutie,zhufangbutie,kaoqin,yingfagongzi,yanglaobaoxian,zhufang,shifagongzi;printf("创建【三】工资信息文件.....\n");printf(" 共创建人数:%d\n",number);if ((fp = fopen("employee.dat", "rb")) == NULL){printf("Can't open file\n");exit(0);}fread(emp,sizeof(struct employee),number, fp);if ((fp2 = fopen("emp_kao.dat", "rb")) == NULL){printf("Can't open file\n");exit(0);}fread(emp_kaoqin,sizeof(struct emp_kao),number, fp2);if ((fp3 = fopen("emp_gong.dat", "wb")) == NULL){printf("Can't open file\n");exit(0);}for (i=0;i<number;i++){j=i+1;strcpy(emp_gongzi[i].name, emp[i].name);strcpy(emp_gongzi[i].num, emp[i].num);floatzhiwugongzi,zhiwubutie,zhufangbutie,kaoqin,yingfagongzi,yanglaobaoxian,zhufang,shifagongzi; if (strcmp(emp[i].degree,zhugong) == 0){zhiwugongzi=720*(1+(emp[i].nianxian*2)/100);zhiwubutie=zhiwugongzi*25/100;zhufangbutie=(zhiwugongzi+zhiwubutie)*25/100;if (emp_kaoqin[i].tianshu>=20){kaoqin=10*emp_kaoqin[i].tianshu;}else if ((emp_kaoqin[i].tianshu>=10)&&(emp_kaoqin[i].tianshu<20)){kaoqin=5*emp_kaoqin[i].tianshu;}else{kaoqin=0;}yingfagongzi=zhiwugongzi+zhiwubutie+zhufangbutie+kaoqin;yanglaobaoxian=(zhiwugongzi+zhiwubutie)*0.1;zhufang=yingfagongzi*0.05;shifagongzi=yingfagongzi-yanglaobaoxian-zhufang;emp_gongzi[i].zhiwugongzi=zhiwugongzi;emp_gongzi[i].zhiwubutie=zhufangbutie;emp_gongzi[i].zhufangbutie=zhufangbutie;emp_gongzi[i].kaoqin=kaoqin;emp_gongzi[i].yingfagongzi=yingfagongzi;emp_gongzi[i].yanglaobaoxian=yanglaobaoxian;emp_gongzi[i].zhufang=zhufang;emp_gongzi[i].shifagongzi=shifagongzi;}if (strcmp(emp[i].degree,gongchengshi) == 0){zhiwugongzi=960*(1+(emp[i].nianxian*3)/100);zhiwubutie=zhiwugongzi*25/100;zhufangbutie=(zhiwugongzi+zhiwubutie)*25/100;if (emp_kaoqin[i].tianshu>=20){kaoqin=10*emp_kaoqin[i].tianshu;}else if ((emp_kaoqin[i].tianshu>=10)&&(emp_kaoqin[i].tianshu<20)) {kaoqin=5*emp_kaoqin[i].tianshu;}else{kaoqin=0;}yingfagongzi=zhiwugongzi+zhiwubutie+zhufangbutie+kaoqin;yingfagongzi=zhiwugongzi+zhiwubutie+zhufangbutie+kaoqin;yanglaobaoxian=(zhiwugongzi+zhiwubutie)*0.1;zhufang=yingfagongzi*0.05;shifagongzi=yingfagongzi-yanglaobaoxian-zhufang;emp_gongzi[i].zhiwugongzi=zhiwugongzi;emp_gongzi[i].zhiwubutie=zhufangbutie;emp_gongzi[i].zhufangbutie=zhufangbutie;emp_gongzi[i].kaoqin=kaoqin;emp_gongzi[i].yingfagongzi=yingfagongzi;emp_gongzi[i].yanglaobaoxian=yanglaobaoxian;emp_gongzi[i].zhufang=zhufang;emp_gongzi[i].shifagongzi=shifagongzi;}if (strcmp(emp[i].degree,gaojigongchengshi) == 0){zhiwugongzi=1350*(1+(emp[i].nianxian*5)/100);zhiwubutie=zhiwugongzi*25/100;zhufangbutie=(zhiwugongzi+zhiwubutie)*25/100;if (emp_kaoqin[i].tianshu>=20){kaoqin=10*emp_kaoqin[i].tianshu;}else if ((emp_kaoqin[i].tianshu>=10)&&(emp_kaoqin[i].tianshu<20)) {kaoqin=5*emp_kaoqin[i].tianshu;}else{kaoqin=0;}yingfagongzi=zhiwugongzi+zhiwubutie+zhufangbutie+kaoqin;yingfagongzi=zhiwugongzi+zhiwubutie+zhufangbutie+kaoqin;yanglaobaoxian=(zhiwugongzi+zhiwubutie)*0.1;zhufang=yingfagongzi*0.05;shifagongzi=yingfagongzi-yanglaobaoxian-zhufang;emp_gongzi[i].zhiwugongzi=zhiwugongzi;emp_gongzi[i].zhiwubutie=zhufangbutie;emp_gongzi[i].zhufangbutie=zhufangbutie;emp_gongzi[i].kaoqin=kaoqin;emp_gongzi[i].yingfagongzi=yingfagongzi;emp_gongzi[i].yanglaobaoxian=yanglaobaoxian;emp_gongzi[i].zhufang=zhufang;emp_gongzi[i].shifagongzi=shifagongzi;}printf("\n");}fwrite(emp_gongzi, sizeof(struct emp_gong),number, fp3);fclose(fp);fclose(fp2);fclose(fp3);if ((fp = fopen("emp_gong.dat", "rb+")) == NULL){printf("Can't open file\n");exit(0);}printf(" 自动创建成功!!\n\n\n");for (i = 0; fread(&emp_gongzi[i],sizeof(struct emp_gong),1,fp) == 1 ; i++){printf("编号%s 姓名%s 职务工资%f 职务补贴%f 住房补贴%f\n考勤管理奖%f 应发工资%f 养老保险%f 住房公积金%f 实发工资%f\n",emp_gongzi[i].num,emp_gongzi[i].name,emp_gongzi[i].zhiwugongzi,emp_gongzi[i].zhiwubutie, emp_gongzi[i].zhufangbutie,emp_gongzi[i].kaoqin,emp_gongzi[i].yingfagongzi,emp_gongzi[i].yanglaobaoxian,emp_gongzi[i].zhufang,emp_gongzi[i].shifagongzi);printf("\n\n\n");}fclose(fp);}void pai(){int i,j;int t;char temp[10];for (i=0;i<number;i++){for (j=i+1;j<number;j++){if (strcmp(emp[i].num,emp[j].num)>0){strcpy(temp, emp[i].num);strcpy(emp[i].num,emp[j].num);strcpy( emp[j].num,temp);strcpy(temp, emp[i].name);strcpy(emp[i].name,emp[j].name);strcpy(emp[j].name,temp);strcpy(temp, emp[i].sex);strcpy(emp[i].sex,emp[j].sex);strcpy( emp[j].sex,temp);strcpy(temp, emp[i].shengri);strcpy(emp[i].shengri,emp[j].shengri);strcpy( emp[j].shengri,temp);strcpy(temp, emp[i].degree);strcpy(emp[i].degree,emp[j].degree);strcpy( emp[j].degree,temp);t=emp[i].nianxian;emp[i].nianxian=emp[j].nianxian;emp[j].nianxian=t;}}}}void put(){printf(" ********企业职工工资管理系统********\n");printf("创建:\n【一】基本信息文件\n【二】考勤记录文件(每个月1份)\n【三】工资信息文件(每个月1份)\n");printf("操作:\n");printf("【1】增加人事基本信息|\n");printf("【2】删除人事基本信息|\n");printf("【3】修改人事基本信息|\n");printf("【4】查询人事基本信息|\n");printf("【5】输出某月份的职工的工资信息|\n");printf("【6】职工工资信息进行统计|\n");}void Chakan(){FILE *fp;int i;if ((fp = fopen("employee.dat", "rb+")) == NULL){printf("Can't open file\n");exit(0);}printf(" 查看成功!!\n");printf(" 编号姓名性别出生日期职称工作年限\n");for (i = 0; fread(&emp[i],sizeof(struct employee),1,fp) == 1 ; i++){printf(" %s %s %s %s %s %d\n",emp[i].num,emp[i].name,emp[i].s ex,emp[i].shengri,emp[i].degree,emp[i].nianxian);}fclose(fp);//goto chakan;}void Chakan2(){FILE *fp;int i;char name[15];printf("请您输入要查看的考勤文件:\n");scanf("%s",name);if ((fp = fopen(name, "rb+")) == NULL){printf("Can't open file\n");exit(0);}printf(" 查看成功!!\n");printf(" 编号姓名日期出勤天数\n");for (i = 0; fread(&emp_kaoqin[i],sizeof(struct emp_kao),1,fp) == 1 ; i++){printf(" %s %s %s %d\n",emp_kaoqin[i].num,emp_kaoqin[i].name,emp_ka oqin[i].riqi,emp_kaoqin[i].tianshu);}fclose(fp);//goto chakan;}void Chakan3(){FILE *fp;int i;char name[15];printf("请您输入要查看的工资文件:\n");scanf("%s",name);if ((fp = fopen(name, "rb+")) == NULL){printf("Can't open file\n");exit(0);}printf(" 查看成功!!\n");for (i = 0; fread(&emp_gongzi[i],sizeof(struct emp_gong),1,fp) == 1 ; i++){printf("编号%s 姓名%s 职务工资%f 职务补贴%f 住房补贴%f\n考勤管理奖%f 应发工资%f 养老保险%f 住房公积金%f 实发工资%f\n",emp_gongzi[i].num,emp_gongzi[i].name,emp_gongzi[i].zhiwugongzi,emp_gongzi[i].zhiwubutie,emp_gongzi[i].zhufangbutie,emp_gongzi[i].kaoqin,emp_gongzi[i].yingfagongzi,emp_gongzi[i].yanglaobaoxian, emp_gongzi[i].zhufang,emp_gongzi[i].shifagongzi);printf("\n\n\n");}fclose(fp);//goto chakan;}void add(){FILE *fp;int i;if ((fp = fopen("number.dat", "rb+")) == NULL){printf("Can't open file\n");exit(0);fread(&number,sizeof(int),1,fp);fclose(fp);if ((fp = fopen("employee.dat", "rb+")) == NULL){printf("Can't open file\n");exit(0);}fread(emp,sizeof(struct employee),number,fp);fclose(fp);if ((fp = fopen("employee.dat", "wb+")) == NULL){printf("Can't open file\n");exit(0);}printf("编号姓名性别出生日期职称工作年限\n");scanf(" %s %s %s %s %s %d",emp[number].num,emp[number].name,emp[n umber].sex,emp[number].shengri,emp[number].degree,&emp[number].nianxian);number++;pai();fwrite(emp,sizeof(struct employee),number, fp);fclose(fp);if ((fp = fopen("number.dat", "wb+")) == NULL){printf("Can't open file\n");exit(0);}fwrite(&number,sizeof(int),1,fp);fclose(fp);if ((fp = fopen("employee.dat", "rb+")) == NULL){printf("Can't open file\n");exit(0);}printf(" 添加成功!!\n");printf(" 编号姓名性别出生日期职称工作年限\n");for (i = 0; fread(&emp[i],sizeof(struct employee),1,fp) == 1 ; i++)printf(" %s %s %s %s %s %d\n",emp[i].num,emp[i].name,emp[i].s ex,emp[i].shengri,emp[i].degree,emp[i].nianxian);}fclose(fp);}void del(){FILE *fp;int i;char num[5];if ((fp = fopen("number.dat", "rb+")) == NULL){printf("Can't open file\n");exit(0);}fread(&number,sizeof(int),1,fp);fclose(fp);if ((fp = fopen("employee.dat", "rb+")) == NULL){printf("Can't open file\n");exit(0);}fread(emp,sizeof(struct employee),number,fp);fclose(fp);if ((fp = fopen("employee.dat", "wb+")) == NULL){printf("Can't open file\n");exit(0);}printf("请您输入编号:\n");scanf("%s",num);for (i=0;i<number;i++){if (strcmp(num, emp[i].num) != 0){fwrite(&emp[i], sizeof(struct employee), 1, fp);}number--;fclose(fp);if ((fp = fopen("number.dat", "wb+")) == NULL){printf("Can't open file\n");exit(0);}fwrite(&number,sizeof(int),1,fp);fclose(fp);if ((fp = fopen("employee.dat", "rb+")) == NULL){printf("Can't open file\n");exit(0);}printf(" 删除成功!!\n");printf(" 编号姓名性别出生日期职称工作年限\n");for (i = 0; fread(&emp[i],sizeof(struct employee),1,fp) == 1 ; i++){printf(" %s %s %s %s %s %d\n",emp[i].num,emp[i].name,emp[i].s ex,emp[i].shengri,emp[i].degree,emp[i].nianxian);}fclose(fp);}void xiugai(){FILE *fp;int i;char num[5];int flag=1;if ((fp = fopen("number.dat", "rb+")) == NULL){printf("Can't open file\n");exit(0);}fread(&number,sizeof(int),1,fp);fclose(fp);if ((fp = fopen("employee.dat", "rb+")) == NULL){printf("Can't open file\n");exit(0);}fread(emp,sizeof(struct employee),number,fp);fclose(fp);if ((fp = fopen("employee.dat", "wb+")) == NULL){printf("Can't open file\n");exit(0);}printf("请您输入编号:\n");scanf("%s",num);for (i=0;i<number;i++){if (strcmp(num,emp[i].num)==0){printf("搜索到!!请您修改:\n");printf("职称:现任年限:\n");scanf("%s %d",emp[i].degree,&emp[i].nianxian);flag=2;}}fwrite(emp, sizeof(struct employee), number, fp);fclose(fp);if(flag==2){if ((fp = fopen("employee.dat", "rb+")) == NULL){printf("Can't open file\n");exit(0);}printf(" 修改成功!!\n");printf(" 编号姓名性别出生日期职称工作年限\n");for (i = 0; fread(&emp[i],sizeof(struct employee),1,fp) == 1 ; i++){printf(" %s %s %s %s %s %d\n",emp[i].num,emp[i].name,emp[i].s ex,emp[i].shengri,emp[i].degree,emp[i].nianxian);}fclose(fp);}else{printf("该信息不存在\n");}}void gengxin(){char nian[15];char nian2[15];FILE *fp,*fp2,*fp3;int i,j;printf("更新考勤记录文件.....\n");printf(" 请输入年月(k.dat):\n");scanf("%s",nian);printf(" 编号姓名日期出勤次数\n",number);if ((fp = fopen("number.dat", "rb+")) == NULL){printf("Can't open file\n");exit(0);}fread(&number,sizeof(int),1,fp);fclose(fp);if ((fp = fopen("employee.dat", "rb")) == NULL){printf("Can't open file\n");exit(0);}fread(emp,sizeof(struct employee),number, fp);if ((fp2 = fopen(nian, "wb")) == NULL){printf("Can't open file\n");exit(0);}for (i=0;i<number;i++){j=i+1;strcpy(emp_kaoqin[i].name, emp[i].name);strcpy(emp_kaoqin[i].num, emp[i].num);printf("->【%d】%s %s",j,emp_kaoqin[i].num,emp_kaoqin[i].name);scanf(" %s %d",emp_kaoqin[i].riqi,&emp_kaoqin[i].tianshu);printf("\n");}fwrite(emp_kaoqin, sizeof(struct emp_kao),number, fp2);fclose(fp);fclose(fp2);if ((fp = fopen(nian, "rb+")) == NULL){printf("Can't open file\n");exit(0);}printf("更新成功!!\n");printf(" 编号姓名日期出勤天数\n");for (i = 0; fread(&emp_kaoqin[i],sizeof(struct emp_kao),1,fp) == 1 ; i++){printf(" %s %s %s %d\n",emp_kaoqin[i].num,emp_kaoqin[i].name,emp_ka oqin[i].riqi,emp_kaoqin[i].tianshu);}fclose(fp);printf("更新工资文件.....\n");printf(" 请输入年月(g.dat):\n");scanf("%s",nian);char *zhugong="助工";char *gongchengshi="工程师";char *gaojigongchengshi="高级工程师";floatzhiwugongzi,zhiwubutie,zhufangbutie,kaoqin,yingfagongzi,yanglaobaoxian,zhufang,shifagongzi;if ((fp = fopen("employee.dat", "rb")) == NULL){printf("Can't open file\n");exit(0);}fread(emp,sizeof(struct employee),number, fp);if ((fp2 = fopen("emp_kao.dat", "rb")) == NULL){printf("Can't open file\n");exit(0);}fread(emp_kaoqin,sizeof(struct emp_kao),number, fp2);if ((fp3 = fopen(nian, "wb")) == NULL){printf("Can't open file\n");exit(0);}for (i=0;i<number;i++){j=i+1;strcpy(emp_gongzi[i].name, emp[i].name);strcpy(emp_gongzi[i].num, emp[i].num);floatzhiwugongzi,zhiwubutie,zhufangbutie,kaoqin,yingfagongzi,yanglaobaoxian,zhufang,shifagongzi;if (strcmp(emp[i].degree,zhugong) == 0){zhiwugongzi=720*(1+(emp[i].nianxian*2)/100);zhiwubutie=zhiwugongzi*25/100;zhufangbutie=(zhiwugongzi+zhiwubutie)*25/100;if (emp_kaoqin[i].tianshu>=20){kaoqin=10*emp_kaoqin[i].tianshu;}else if ((emp_kaoqin[i].tianshu>=10)&&(emp_kaoqin[i].tianshu<20)){kaoqin=5*emp_kaoqin[i].tianshu;}else{kaoqin=0;}yingfagongzi=zhiwugongzi+zhiwubutie+zhufangbutie+kaoqin;yanglaobaoxian=(zhiwugongzi+zhiwubutie)*0.1;zhufang=yingfagongzi*0.05;shifagongzi=yingfagongzi-yanglaobaoxian-zhufang;emp_gongzi[i].zhiwugongzi=zhiwugongzi;emp_gongzi[i].zhiwubutie=zhufangbutie;emp_gongzi[i].zhufangbutie=zhufangbutie;emp_gongzi[i].kaoqin=kaoqin;emp_gongzi[i].yingfagongzi=yingfagongzi;emp_gongzi[i].yanglaobaoxian=yanglaobaoxian;emp_gongzi[i].zhufang=zhufang;emp_gongzi[i].shifagongzi=shifagongzi;}if (strcmp(emp[i].degree,gongchengshi) == 0){zhiwugongzi=960*(1+(emp[i].nianxian*3)/100);zhiwubutie=zhiwugongzi*25/100;zhufangbutie=(zhiwugongzi+zhiwubutie)*25/100;if (emp_kaoqin[i].tianshu>=20){kaoqin=10*emp_kaoqin[i].tianshu;}else if ((emp_kaoqin[i].tianshu>=10)&&(emp_kaoqin[i].tianshu<20)) {kaoqin=5*emp_kaoqin[i].tianshu;}else{kaoqin=0;}yingfagongzi=zhiwugongzi+zhiwubutie+zhufangbutie+kaoqin;yingfagongzi=zhiwugongzi+zhiwubutie+zhufangbutie+kaoqin;yanglaobaoxian=(zhiwugongzi+zhiwubutie)*0.1;zhufang=yingfagongzi*0.05;shifagongzi=yingfagongzi-yanglaobaoxian-zhufang;emp_gongzi[i].zhiwugongzi=zhiwugongzi;emp_gongzi[i].zhiwubutie=zhufangbutie;emp_gongzi[i].zhufangbutie=zhufangbutie;emp_gongzi[i].kaoqin=kaoqin;emp_gongzi[i].yingfagongzi=yingfagongzi;emp_gongzi[i].yanglaobaoxian=yanglaobaoxian;emp_gongzi[i].zhufang=zhufang;emp_gongzi[i].shifagongzi=shifagongzi;}if (strcmp(emp[i].degree,gaojigongchengshi) == 0){zhiwugongzi=1350*(1+(emp[i].nianxian*5)/100);zhiwubutie=zhiwugongzi*25/100;zhufangbutie=(zhiwugongzi+zhiwubutie)*25/100;if (emp_kaoqin[i].tianshu>=20){kaoqin=10*emp_kaoqin[i].tianshu;}else if ((emp_kaoqin[i].tianshu>=10)&&(emp_kaoqin[i].tianshu<20)) {kaoqin=5*emp_kaoqin[i].tianshu;}else{kaoqin=0;}yingfagongzi=zhiwugongzi+zhiwubutie+zhufangbutie+kaoqin;yingfagongzi=zhiwugongzi+zhiwubutie+zhufangbutie+kaoqin;yanglaobaoxian=(zhiwugongzi+zhiwubutie)*0.1;zhufang=yingfagongzi*0.05;shifagongzi=yingfagongzi-yanglaobaoxian-zhufang;emp_gongzi[i].zhiwugongzi=zhiwugongzi;emp_gongzi[i].zhiwubutie=zhufangbutie;emp_gongzi[i].zhufangbutie=zhufangbutie;emp_gongzi[i].kaoqin=kaoqin;emp_gongzi[i].yingfagongzi=yingfagongzi;emp_gongzi[i].yanglaobaoxian=yanglaobaoxian;emp_gongzi[i].zhufang=zhufang;emp_gongzi[i].shifagongzi=shifagongzi;}printf("\n");}fwrite(emp_gongzi, sizeof(struct emp_gong),number, fp3);fclose(fp);fclose(fp2);fclose(fp3);if ((fp = fopen(nian, "rb+")) == NULL){printf("Can't open file\n");exit(0);}printf(" 更新成功!!\n");for (i = 0; fread(&emp_gongzi[i],sizeof(struct emp_gong),1,fp) == 1 ; i++){printf("编号%s 姓名%s 职务工资%f 职务补贴%f 住房补贴%f\n考勤管理奖%f 应发工资%f 养老保险%f 住房公积金%f 实发工资%f\n",emp_gongzi[i].num,emp_gongzi[i].name,emp_gongzi[i].zhiwugongzi,emp_gongzi[i].zhiwubutie,emp_gongzi[i].zhufangbutie,emp_gongzi[i].kaoqin,emp_gongzi[i].yingfagongzi,emp_gongzi[i].yanglaobaoxian, emp_gongzi[i].zhufang,emp_gongzi[i].shifagongzi);printf("\n\n\n");}fclose(fp);}void findnum(){FILE *fp;int i;char num[5];int flag=1;if ((fp = fopen("number.dat", "rb+")) == NULL){printf("Can't open file\n");exit(0);}fread(&number,sizeof(int),1,fp);fclose(fp);if ((fp = fopen("emp_gong.dat", "rb+")) == NULL){printf("Can't open file\n");exit(0);}fread(emp_gongzi,sizeof(struct emp_gong),number,fp);fclose(fp);printf("请您输入编号:\n");scanf("%s",num);for (i=0;i<number;i++){if (strcmp(num, emp_gongzi[i].num) == 0){printf("搜索成功!!\n");printf("编号%s 姓名%s 职务工资%f 职务补贴%f 住房补贴%f\n考勤管理奖%f 应发工资%f 养老保险%f 住房公积金%f 实发工资%f\n",emp_gongzi[i].num,emp_gongzi[i].name,emp_gongzi[i].zhiwugongzi,emp_gongzi[i].zhiwubutie,emp_gongzi[i].zhufangbutie,emp_gongzi[i].kaoqin,emp_gongzi[i].yingfagongzi,emp_gongzi[i].yanglaobaoxian,emp_gongzi[i].zhufang,emp_gongzi[i].shifagongzi);flag=2;}}if (flag==1){printf("该信息不存在\n");}}void findname(){FILE *fp;int i;char name[10];int flag=1;if ((fp = fopen("number.dat", "rb+")) == NULL){printf("Can't open file\n");exit(0);}fread(&number,sizeof(int),1,fp);fclose(fp);if ((fp = fopen("emp_gong.dat", "rb+")) == NULL){printf("Can't open file\n");exit(0);}fread(emp_gongzi,sizeof(struct emp_gong),number,fp);fclose(fp);printf("请您输入姓名:\n");scanf("%s",name);for (i=0;i<number;i++){if (strcmp(name, emp_gongzi[i].name) == 0){printf("搜索成功!!\n");printf("搜索成功!!\n");printf("编号%s 姓名%s 职务工资%f 职务补贴%f 住房补贴%f\n考勤管理奖%f 应发工资%f 养老保险%f 住房公积金%f 实发工资%f\n",emp_gongzi[i].num,emp_gongzi[i].name,emp_gongzi[i].zhiwugongzi,emp_gongzi[i].zhiwubutie,emp_gongzi[i].zhufangbutie,emp_gongzi[i].kaoqin,emp_gongzi[i].yingfagongzi,emp_gongzi[i].yanglaobaoxian, emp_gongzi[i].zhufang,emp_gongzi[i].shifagongzi);flag=2;}}if (flag==1){printf("该信息不存在\n");}}void findname2(){FILE *fp;int i;char name[10];int flag=1;if ((fp = fopen("number.dat", "rb+")) == NULL){printf("Can't open file\n");exit(0);}fread(&number,sizeof(int),1,fp);fclose(fp);if ((fp = fopen("emp_gong.dat", "rb+")) == NULL){printf("Can't open file\n");exit(0);}fread(emp_gongzi,sizeof(struct emp_gong),number,fp);fclose(fp);printf("请您输入姓:\n");scanf("%s",name);for (i=0;i<number;i++){if (name[0]==emp_gongzi[i].name[0]){。

相关主题