博主简介:
Hello大家好呀,我是陈童学,一个与你一样正在慢慢前行的人。
博主主页:@陈童学哦
所属专栏:C语言程序设计实验项目
如果本文对你有所帮助的话,还希望可以点赞收藏支持一下哦!
前言:员工管理系统是一款面向公司管理员的管理工具,旨在提供员工信息管理、薪资管理、员工绩效评估、员工福利管理和智能推荐等功能,帮助公司管理员更好地管理员工信息和提高员工工作效率。
这是总体设计大概模型图:
//员工信息结构体
struct Employee
{
int Number; //工号
char Name[250]; //姓名
char Sex[100]; //性别
int Age; //年龄
ll Phonenumber; //电话号码
char job[200]; //职位
int Salary; //基本工资
};
//员工薪资发放结构体
struct payment
{
int number; //工号
char name[200]; //姓名
int money; //应发薪资
int judge; //发放状态
};
//员工绩效评估结构体
struct node
{
int Number; //工号
char Name[200];//姓名
int first;//第一次评分
int second;//第二次评分
int third;//第三次评分
double final=0;//综合评分
char grade[200];//评估等级
};
//评估等级对应的福利奖金结构体
struct Benefit
{
char grade[200]; //评估等级
int bonus; //对应福利奖金
};
//员工的福利结构体
struct Welfare
{
int Number; //工号
char name[200]; //姓名
char grade[200];//评估等级
int money;//应发福利奖金
int judge;//发放状态
};
//培训结构体
struct training
{
char grade[200]; //评估等级
char recommend[1001]; //推荐的东西
};
void Add(); //添加信息
void inquire();//查询信息
void Delete();//删除信息
void Modify();//修改信息
void Payroll_Management(); //薪资管理菜单
void Employee_Information_Management();//员工信息管理菜单
bool Isrepeated(int number); //判断工号是否重复
void personnel_performance_appraisal();//员工绩效评估菜单
void employee_benefits_management(); //员工福利管理菜单
void employee_recommend(); //员工推荐菜单
bool IsSix(); //判断工号是否为6位数
void payroll_is_paid(); //薪资发放
void Salary_enquiry(); //薪资查询
void Performance_evaluation(); //绩效评估
void Performance_queries(); //绩效查询
void Welfare_distribution(); //福利发放
void Benefits_Inquiry(); //福利查询
void Recommended_positions(); //推荐职位
void Recommended_training(); //推荐培训
int Finalresult(double a); //测试评估等级
void entertainment(); //休闲娱乐菜单
bool IsPhone(ll num); //判断手机号是否是11位
int main()
{
while(1)
{
printf("=====================欢迎使用员工管理系统======================\n\n");
printf("***************************************************************\n");
printf("----------------1.员工信息管理\t2.薪资管理---------------------\n");
printf("----------------3.员工绩效评估\t4.员工福利管理-----------------\n");
printf("----------------5.推荐\t\t6.休闲娱乐-------------------------\n");
printf("----------------7.退出\t\t\t -------------------------\n");
printf("***************************************************************\n");
int choice;
printf("请输入你的选择:");
again:
scanf("%d",&choice);
switch (choice)
{
case 1:
system("cls");
Employee_Information_Management();
break;
case 2:
system("cls");
Payroll_Management();
break;
case 3:
system("cls");
personnel_performance_appraisal();
break;
case 4:
system("cls");
employee_benefits_management();
break;
case 5:
system("cls");
employee_recommend();
break;
case 7:
printf("已退出!!!!!!!!!!!感谢使用!!!!!!!!!");
return 0;
break;
case 6:
system("cls");
entertainment();
break;
default:
printf("输入有误,请您重新输入:");
goto again;
break;
}
}
}
//员工信息管理菜单
void Employee_Information_Management()
{
while(1)
{
printf("==================欢迎来到员工信息管理界面=====================\n\n");
printf("***************************************************************\n");
printf("\t1.添加员工信息\t2.删除员工信息\n");
printf("\t3.修改员工信息\t4.查询员工信息\n\t5.退出\n");
printf("***************************************************************\n");
int choice;
printf("请输入您需要进行的操作:");
again:
scanf("%d",&choice);
if(choice==1)
{
Add();
system("cls");
}
else if(choice==2)
{
Delete();
system("cls");
}
else if(choice==3)
{
Modify();
}
else if(choice==4)
{
inquire();
system("cls");
}
else if(choice==5)
{
system("cls");
return;
}
else
{
printf("输入有误,请您重新输入:");
goto again;
}
}
}
1. 添加员工:管理员可以添加新员工信息,包括工号、姓名、年龄、性别、联系方式、职位信息。
//添加!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
void Add()
{
while(1)
{
struct Employee Old[100],New;
int i=0,j;
FILE *fp;
fp=fopen("E:\\EmployeeHH\\Employeemessage_Subtext.txt","r+");
while(fscanf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d",&Old[i].Number,Old[i].Name,Old[i].Sex,&Old[i].Age,&Old[i].Phonenumber,Old[i].job,&Old[i].Salary)==7)
i++;
fclose(fp);
printf("请输入该员工的姓名:");
scanf("%s",New.Name);
printf("请输入该员工的性别(1.男/2.女):");
int choose;
again2:
scanf("%d",&choose);
if(choose==1)
{
strcpy(Old[i].Sex,"男");
}
else if(choose==2)
{
strcpy(Old[i].Sex,"女");
}
else
{
printf("输入有误,请重新输入:");
goto again2;
}
printf("请输入该员工的年龄:");
scanf("%d",&New.Age);
printf("请输入该员工的联系方式(手机号):");
again3:
scanf("%lld",&New.Phonenumber);
if(!IsPhone(New.Phonenumber))
{
printf("输入有误,手机号应为11位,请重新输入:");
goto again3;
}
char location[200];
printf("\t1.董事长\t2.总经理\n");
printf("\t3.总监\t4.经理\n");
printf("\t5.主管\t6.组长\n");
printf("\t7.员工\t8.待定\n");
int choice;
printf("请选择该员工的职位:");
scanf("%d",&choice);
switch(choice)
{
case 1:
strcpy(location,"董事长");
Isposition(&New,location);
break;
case 2:
strcpy(location,"总经理");
Isposition(&New,location);
break;
case 3:
strcpy(location,"总监");
Isposition(&New,location);
break;
case 4:
strcpy(location,"经理");
Isposition(&New,location);
break;
case 5:
strcpy(location,"主管");
Isposition(&New,location);
break;
case 6:
strcpy(location,"组长");
Isposition(&New,location);
break;
case 7:
strcpy(location,"员工");
Isposition(&New,location);
break;
case 8:
strcpy(location,"待定");
Isposition(&New,location);
break;
}
printf("请赋予该员工工号(6位数):");
again1:
scanf("%d",&New.Number);
if( Isrepeated(New.Number) )
{
printf("该工号已存在,请重新给予该员工工号:");
goto again1;
}
if(!IsSix(New.Number))
{
printf("工号应为6位数,请重新输入:");
goto again1;
}
printf("输入完毕,该员工信息已录入!");
strcpy(Old[i].Name,New.Name);
Old[i].Number=New.Number;
Old[i].Phonenumber=New.Phonenumber;
Old[i].Age=New.Age;
strcpy(Old[i].job,New.job);
Old[i].Salary=New.Salary;
i++;
fp=fopen("E:\\EmployeeHH\\Emoloyeemessage_Positive_text.txt","w+");
fputs("工号\t姓名\t性别\t年龄\t联系方式\t\t职位\t基本工资\n",fp);
for(j=0;j<i;j++)
{
fprintf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d\n",Old[j].Number,Old[j].Name,Old[j].Sex,Old[j].Age,Old[j].Phonenumber,Old[j].job,Old[j].Salary);
}
fclose(fp);
fp=fopen("E:\\EmployeeHH\\Employeemessage_Subtext.txt","w+");
for(j=0;j<i;j++)
{
fprintf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d\n",Old[j].Number,Old[j].Name,Old[j].Sex,Old[j].Age,Old[j].Phonenumber,Old[j].job,Old[j].Salary);
}
fclose(fp);
printf("\n是否还要录入员工信息:(Y/N)");
char c;
getchar();
scanf("%c",&c);
if(c=='Y')
continue;
else
break;
}
}
添加员工信息功能中用到的一些相关函数!!!!
//判断工号是否重复!!!!!!
bool Isrepeated(int number)
{
struct Employee Old[100];
int i=0,j;
FILE *fp;
fp=fopen("E:\\EmployeeHH\\Employeemessage.txt","r+");
while(fscanf(fp,"%d %s %s %d %d",&Old[i].Number,Old[i].Name,Old[i].Sex,&Old[i].Age,&Old[i].Salary)==5)
i++;
for(j=0;j<i;j++)
{
if(Old[j].Number==number)
return true;
}
return false;
}
//判断工号是否为6位数
bool IsSix(int num)
{
int count=0;
while(num)
{
num/=10;
count++;
}
if(count==6)
return true;
else
return false;
}
//判断手机号是否是11位
bool IsPhone(ll num)
{
int count=0;
while(num)
{
num/=10;
count++;
}
if(count==11)
return true;
else
return false;
}
struct Employee_Sheet
{
char position[200];
int Salary;
};
//给予员工职位
void Isposition(struct Employee *E,char name[200])
{
struct Employee_Sheet Old[100];
int i=0,j;
FILE *fp;
fp=fopen("E:\\EmployeeHH\\Job_Status_Sheet.txt","r+");
while(fscanf(fp,"%s %d",Old[i].position,&Old[i].Salary)==2)
i++;
fclose(fp);
for(j=0;j<i;j++)
{
if(strcmp(name,Old[j].position)==0)
{
strcpy(E->job,name);
E->Salary=Old[j].Salary;
return;
}
}
if(strcmp(name,"待定")==0)
{
strcpy(E->job,name);
E->Salary=0;
}
}
2. 删除员工:管理员可以删除员工信息。
//删除!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
void Delete()
{
while(1)
{
struct Employee Old[100];
int i=0,j;
int Employee_num,Count=0;
FILE *fp;
fp=fopen("E:\\EmployeeHH\\Employeemessage_Subtext.txt","r+");
while(fscanf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d",&Old[i].Number,Old[i].Name,Old[i].Sex,&Old[i].Age,&Old[i].Phonenumber,Old[i].job,&Old[i].Salary)==7)
i++;
fclose(fp);
printf("请输入您需要删除员工的工号:");
scanf("%d",&Employee_num);
fp=fopen("E:\\EmployeeHH\\Emoloyeemessage_Positive_text.txt","w+");
fputs("工号\t姓名\t性别\t年龄\t联系方式\t\t职位\t基本工资\n",fp);
for(j=0;j<i;j++)
{
if(Old[j].Number!=Employee_num)
{
fprintf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d\n",Old[j].Number,Old[j].Name,Old[j].Sex,Old[j].Age,Old[j].Phonenumber,Old[j].job,Old[j].Salary);
Count++;
}
}
fclose(fp);
fp=fopen("E:\\EmployeeHH\\Employeemessage_Subtext.txt","w+");//副文本!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
for(j=0;j<i;j++)
{
if(Old[j].Number!=Employee_num)
{
fprintf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d\n",Old[j].Number,Old[j].Name,Old[j].Sex,Old[j].Age,Old[j].Phonenumber,Old[j].job,Old[j].Salary);
}
}
fclose(fp);
if(Count==i)
{
printf("\n未查询到工号为【%d】的员工,无法进行删除!",Employee_num);
}
else
printf("该员工信息已删除!");
printf("\n是否还要进行删除员工信息操作:(Y/N)");
char c;
getchar();
scanf("%c",&c);
if(c=='Y')
continue;
else
break;
}
}
2. 修改员工信息:管理员可以修改员工的基本信息,如联系方式、职位等。
//修改!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
void Modify()
{
while(1)
{
struct Employee Old[100],New;
int i=0,j,k;
int judge=0;
int num;
FILE *fp;
fp=fopen("E:\\EmployeeHH\\Employeemessage_Subtext.txt","r+");
while(fscanf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d",&Old[i].Number,Old[i].Name,Old[i].Sex,&Old[i].Age,&Old[i].Phonenumber,Old[i].job,&Old[i].Salary)==7)
i++;
fclose(fp);
printf("请输入需要修改信息的员工工号:");
scanf("%d",&num);
for(j=0;j<i;j++)
{
if(Old[j].Number==num)
{
printf("查询到该员工!\n");
judge=1;
printf("请选择需要修改的信息!!!!!\n");
printf("\t1.工号\t2.姓名\n");
printf("\t3.性别\t4.年龄\n");
printf("\t5.联系方式\t6.职位\n");
printf("\t7.退出\n");
printf("请输入你的选择:");
int choice;
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("请输入该员工的工号:");
scanf("%d",&New.Number);
Old[j].Number=New.Number;
break;
case 2:
printf("请输入该员工的姓名:");
scanf("%s",New.Name);
strcpy(Old[j].Name,New.Name);
break;
case 3:
printf("请输入该员工的性别:");
scanf("%s",New.Sex);
strcpy(Old[j].Sex,New.Sex);
break;
case 4:
printf("请输入该员工的年龄:");
scanf("%d",&New.Age);
Old[j].Age=New.Age;
break;
case 5:
printf("请输入该员工的联系方式:");
scanf("%lld",&New.Phonenumber);
Old[j].Phonenumber=New.Phonenumber;
break;
case 6:
{
printf("请选择该员工的职位:");
scanf("%s",New.job);
struct Employee_Sheet Olde[100];
int i=0,j;
FILE *fp;
fp=fopen("E:\\EmployeeHH\\Job_Status_Sheet.txt","r+");
while(fscanf(fp,"%s %d",Olde[i].position,&Olde[i].Salary)==2)
i++;
fclose(fp);
for(j=0;j<i;j++)
{
if(strcmp(New.Name,Olde[j].position)==0)
{
strcpy(Old[j].job,Olde[j].position);
Old[j].Salary=Olde[j].Salary;
return;
}
}
if(strcmp(New.job,"待定")==0)
{
strcpy(Old[j].job,New.job);
Old[j].Salary=0;
}
break;
}
case 7:
exit(0);
break;
}
fp=fopen("E:\\EmployeeHH\\Employeemessage_Subtext.txt","w+");
for(k=0;k<i;k++)
{
fprintf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d\n",Old[k].Number,Old[k].Name,Old[k].Sex,Old[k].Age,Old[k].Phonenumber,Old[k].job,Old[k].Salary);
}
fclose(fp);
fp=fopen("E:\\EmployeeHH\\Emoloyeemessage_Positive_text.txt","w+");
fputs("工号\t姓名\t性别\t年龄\t联系方式\t\t职位\t基本工资\n",fp);
for(k=0;k<i;k++)
{
fprintf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d\n",Old[k].Number,Old[k].Name,Old[k].Sex,Old[k].Age,Old[k].Phonenumber,Old[k].job,Old[k].Salary);
}
fclose(fp);
printf("修改成功!!!!!!");
break;
}
}
if(!judge)
{
printf("\n未查询到工号为【%d】的员工!\n",num);
break;
}
printf("\n是否还要进行修改员工信息操作:(Y/N)");
char c;
getchar();
scanf("%c",&c);
if(c=='Y')
continue;
else
break;
}
}
4. 查询员工:管理员可以根据员工姓名、职位等信息进行查询。
//查询!!!!!!!!!!!!!!!!!!!!!!!!
void inquire()
{
while(1)
{
struct Employee Old[100];
int i=0,j;
FILE *fp;
fp=fopen("E:\\EmployeeHH\\Employeemessage_Subtext.txt","r+");
while(fscanf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d",&Old[i].Number,Old[i].Name,Old[i].Sex,&Old[i].Age,&Old[i].Phonenumber,Old[i].job,&Old[i].Salary)==7)
i++;
fclose(fp);
printf("\t1.通过工号查询\t2.通过姓名查询\n");
printf("请选择查询的方式:");
int choice; //选择查询方式
int num; //员工工号
char name[50]; //员工姓名
again:
scanf("%d",&choice);
int judge=0;
if(choice==1)
{
printf("请输入员工工号:");
scanf("%d",&num);
for(j=0;j<i;j++)
{
if(Old[j].Number==num)
{
printf("【工号】:%d 【姓名】:%s 【性别】:%s\n【年龄】:%d 【联系方式】:%lld\n【职位】:%s【基本工资】:%d\n",Old[j].Number,Old[j].Name,Old[j].Sex,Old[j].Age,Old[j].Phonenumber,Old[j].job,Old[j].Salary);
judge=1;
}
}
if(!judge)
printf("未查询到工号为【%d】的员工\n",num);
}
else if(choice==2)
{
printf("请输入员工姓名:");
scanf("%s",name);
for(j=0;j<i;j++)
{
if(strcmp(Old[j].Name,name)==0)
{
printf("【工号】:%d 【姓名】:%s \n【性别】:%s\n【年龄】:%d 【联系方式】:%lld\n【职位】:%s【基本工资】:%d\n",Old[j].Number,Old[j].Name,Old[j].Sex,Old[j].Age,Old[j].Phonenumber,Old[j].job,Old[j].Salary);
judge=2;
}
}
if(!judge)
printf("未查询到姓名为【%s】的员工\n",name);
}
else
{
printf("输入有误,请重新输入:");
goto again;
}
printf("\n是否还要进行查询员工信息操作:(Y/N)");
char c;
getchar();
scanf("%c",&c);
if(c=='Y')
continue;
else
break;
}
}
//薪资管理菜单!!!!!!!!!!!!!!!!!!
void Payroll_Management()
{
while(1)
{
printf("====================欢迎来到薪资管理界面=======================\n");
printf("***************************************************************\n");
printf("\t1.薪资发放\t2.薪资查询\n\t3.退出\n");
printf("***************************************************************\n");
int choice;
printf("请输入您需要进行的操作:");
again:
scanf("%d",&choice);
if(choice==1)
{
payroll_is_paid();
system("cls");
}
else if(choice==2)
{
Salary_enquiry();
system("cls");
}
else if(choice==3)
{
system("cls");
return;
}
else
{
printf("输入有误,请您重新输入:");
goto again;
}
}
}
1. 薪资发放:管理员可以根据员工的工作表现和薪资标准进行薪资发放。
//薪资发放
void payroll_is_paid()
{
while(1)
{
struct payment Old1[100];
struct Employee Old2[100];
int i1=0,i2=0,j;
int judge1=0,judge2=0;
printf("======欢迎来到薪资发放界面======\n");
FILE *fp;
fp=fopen("E:\\EmployeeHH\\Payroll_Subtext.txt","r+");
while(fscanf(fp,"%d %s %d %d",&Old1[i1].number,Old1[i1].name,&Old1[i1].money,&Old1[i1].judge)==4)
i1++;
fclose(fp);
fp=fopen("E:\\EmployeeHH\\Employeemessage_Subtext.txt","r+");
while(fscanf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d",&Old2[i2].Number,Old2[i2].Name,Old2[i2].Sex,&Old2[i2].Age,&Old2[i2].Phonenumber,Old2[i2].job,&Old2[i2].Salary)==7)
i2++;
fclose(fp);
int num;
printf("请输入需要发放薪资的员工工号:");
scanf("%d",&num);
for(j=0;j<i1;j++)
{
if(Old1[j].number==num)
{
judge1=1;
printf("查询到该员工,该员工为【%s】",Old1[j].name);
if(Old1[j].judge)
{
printf("\n该员工当月薪资【%d元】已发!!!",Old1[j].money);
}
else
{
printf("\n该员工当月薪资【%d元】未发!!!\n",Old1[j].money);
int choice;
again1:
printf("是否发放员工【%s】当月的薪资(1.是/2.否):",Old1[j].name);
scanf("%d",&choice);
if(choice==1)
{
Old1[j].judge=1;
printf("叮咚!!!!员工【%s】当月薪资【%d元】已发放!",Old1[j].name,Old1[j].money);
}
else if(choice==2)
{
Old1[j].judge=0;
printf("叮咚!!!!员工【%s】的薪资【%d元】暂不进行发放",Old1[j].name,Old1[j].money);
}
else
{
printf("输入有误!!!!!!!请重新输入:");
goto again1;
}
}
break;
}
}
if(!judge1)
{
for(j=0;j<i2;j++)
{
if(Old2[j].Number==num)
{
judge2=1;
printf("查询到该员工,该员工为【%s】\n",Old2[j].Name);
printf("该员工当月薪资【%d】还未发放!!!\n",Old2[j].Salary);
int choice;
again2:
printf("是否发放员工【%s】当月的薪资(1.是/2.否):",Old1[j].name);
scanf("%d",&choice);
if(choice==1)
{
Old1[i1].number=num;
Old1[i1].money=Old2[j].Salary;
strcpy(Old1[i1].name,Old2[j].Name);
Old1[i1].judge=1;
printf("叮咚!!!!员工【%s】当月薪资【%d元】已发放!",Old2[j].Name,Old2[i1].Salary);
}
else if(choice==2)
{
Old1[i1].number=num;
Old1[i1].money=Old2[j].Salary;
strcpy(Old1[i1].name,Old2[j].Name);
Old1[i1].judge=0;
printf("叮咚!!!!员工【%s】的薪资【%d元】暂不进行发放",Old2[i1].Name,Old2[i1].Salary);
}
else
{
printf("输入有误!!!!!!!请重新输入:");
goto again2;
}
i1++;
break;
}
}
}
if(!judge1&&!judge2)
{
printf("并未查询到有工号为【%d】的员工!!!!\n",num);
}
fp=fopen("E:\\EmployeeHH\\Payroll_Subtext.txt","r+");
for(j=0;j<i1;j++)
{
fprintf(fp,"%d %s %d %d\n",Old1[j].number,Old1[j].name,Old1[j].money,Old1[j].judge);
}
fclose(fp);
fp=fopen("E:\\EmployeeHH\\Payroll_Positive_text.txt","r+");
fputs("工号\t姓名 应发薪资 发放状态(1.是/2.否)\n",fp);
for(j=0;j<i1;j++)
{
fprintf(fp,"%d %s %d\t%d\n",Old1[j].number,Old1[j].name,Old1[j].money,Old1[j].judge);
}
fclose(fp);
printf("\n是否还要薪资发放操作:(Y/N)");
char c;
getchar();
scanf("%c",&c);
if(c=='Y')
continue;
else
break;
}
}
2. 薪资查询:管理员可以查询员工的薪资信息。
//薪资查询
void Salary_enquiry()
{
while(1)
{
struct payment Old1[100];
struct Employee Old2[100];
int i1=0,i2=0,j;
int judge1=0,judge2=0;
FILE *fp;
fp=fopen("E:\\EmployeeHH\\Payroll_Subtext.txt","r+");
while(fscanf(fp,"%d %s %d %d",&Old1[i1].number,Old1[i1].name,&Old1[i1].money,&Old1[i1].judge)==4)
i1++;
fclose(fp);
fp=fopen("E:\\EmployeeHH\\Employeemessage_Subtext.txt","r+");
while(fscanf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d",&Old2[i2].Number,Old2[i2].Name,Old2[i2].Sex,&Old2[i2].Age,&Old2[i2].Phonenumber,Old2[i2].job,&Old2[i2].Salary)==7)
i2++;
fclose(fp);
printf("======欢迎来到薪资管理界面======\n");
int num;
printf("请输入需要查询薪资的员工工号:");
scanf("%d",&num);
for(j=0;j<i1;j++)
{
if(Old1[j].number==num)
{
judge1=1;
printf("查询到员工【%s】的薪资信息!!其信息如下:\n",Old1[j].name);
if(Old1[j].judge==1)
{
printf("【工号】:%d 【姓名】:%s 【应发薪资】:%d 【发放状态】:已发放",Old1[j].number,Old1[j].name,Old1[j].money);
}
else
{
printf("【工号】:%d 【姓名】:%s 【应发薪资】:%d 【发放状态】:未发放",Old1[j].number,Old1[j].name,Old1[j].money);
}
break;
}
}
if(!judge1)
{
for(j=0;j<i2;j++)
{
if(Old2[j].Number==num)
{
judge2=1;
printf("查询到员工【%s】的薪资信息!!其信息如下:\n",Old2[j].Name);
printf("【工号】:%d 【姓名】:%s 【应发薪资】:%d 【发放状态】:未发放",Old2[j].Number,Old2[j].Name,Old2[j].Salary);
break;
}
}
}
if(!judge1&&!judge2)
{
printf("并未查询到有工号为【%d】的员工!!!!\n",num);
}
printf("\n是否还要薪资查询操作:(Y/N)");
char c;
getchar();
scanf("%c",&c);
if(c=='Y')
continue;
else
break;
}
}
//员工绩效评估菜单
void personnel_performance_appraisal()
{
while(1)
{
printf("***************************************************************\n");
printf("=================欢迎来到员工绩效评估界面======================\n");
printf("\t1.绩效评估\t2.绩效查询\n\t3.退出\n");
printf("***************************************************************\n");
int choice;
printf("请输入你的选择:");
again:
scanf("%d",&choice);
if(choice==1)
{
Performance_evaluation();
system("cls");
}
else if(choice==2)
{
Performance_queries();
system("cls");
}
else if(choice==3)
{
system("cls");
return;
}
else
{
printf("输入有误,请重新输入:");
goto again;
}
}
}
1. 绩效评估:管理员可以根据员工的工作表现进行绩效评估,评估结果包括优秀、良好、一般、差等级别。
//评估等级
int Finalresult(double a)
{
if(a>=80)
return 1;
else if(a>=70)
return 2;
else if(a>=60)
return 3;
else
return 4;
}
//绩效评估
void Performance_evaluation()
{
while(1)
{
struct node Old1[100],stu;
struct Employee Old2[100];
int i1=0,i2=0,j,k;
FILE *fp,*fq;
fp=fopen("E:\\EmployeeHH\\Performance_evaluation_Subtext.txt","r+"); //副文本!!!!!!!!!!!!!!!!!
while(fscanf(fp,"%d %s %d %d %d %lf %s",&Old1[i1].Number,Old1[i1].Name,&Old1[i1].first,&Old1[i1].second,&Old1[i1].third,&Old1[i1].final,Old1[i1].grade)==7)
i1++;
fclose(fp);
int number;
int judge=0;
printf("======欢迎来到绩效评估界面======\n");
printf("请输入你要评估员工的工号:");
scanf("%d",&number);
for(j=0;j<i1;j++)
{
if(number==Old1[j].Number)
{
judge=1;
char choice;
struct node stu;
printf("该员工【%s】当月已进行过评估!\n",Old1[j].Name);
printf("其评估信息为:\n");
printf("当月第一次测评评分为:%d\n",Old1[j].first);
printf("当月第二次测评评分为:%d\n",Old1[j].second);
printf("当月第三次测评评分为:%d\n",Old1[j].third);
printf("当月综合测评评分为:%.2lf\n",Old1[j].final);
printf("当月的评估等级为:%s\n",Old1[j].grade);
printf("是否需要对其重新进行评估(Y/N):");
getchar();
again1:
scanf("%c",&choice);
if(choice=='Y')
{
printf("请为该员工当月的第一次测评打分:");
scanf("%d",&stu.first);
Old1[j].first=stu.first;
printf("请为该员工当月的第二次测评打分:");
scanf("%d",&stu.second);
Old1[j].second=stu.second;
printf("请为该员工当月的第三次测评打分:");
scanf("%d",&stu.third);
Old1[j].third=stu.third;
stu.final=( stu.first+stu.second+stu.third )/3;
Old1[j].final=stu.final;
int t = Finalresult(stu.final);
fp=fopen("E:\\EmployeeHH\\Performance_evaluation_Positive_text.txt","w+");
fq=fopen("E:\\EmployeeHH\\Performance_evaluation_Subtext.txt","w+");
fputs("工号\t姓名 第一次测评评分 第二次测评评分 第三次测评评分 综合评分 评估等级\n",fp);
if(t==1)
{
strcpy(Old1[j].grade,"优");
printf("该员工【%s】最后的评估等级为:【优】\n",Old1[j].Name);
for(k=0;k<i1;k++)
{
fprintf(fp,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fp);
for(k=0;k<i1;k++)
{
fprintf(fq,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fq);
}
else if(t==2)
{
strcpy(Old1[j].grade,"良");
printf("该员工【%s】最后的评估等级为:【良】\n",Old1[j].Name);
for(k=0;k<i1;k++)
{
fprintf(fp,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fp);
for(k=0;k<i1;k++)
{
fprintf(fq,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fq);
}
else if(t==3)
{
strcpy(Old1[j].grade,"一般");
printf("该员工【%s】最后的评估等级为:【一般】\n",Old1[j].Name);
for(k=0;k<i1;k++)
{
fprintf(fp,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fp);
for(k=0;k<i1;k++)
{
fprintf(fq,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fq);
}
else
{
strcpy(Old1[j].grade,"差");
printf("该员工【%s】最后的评估等级为:【差】\n",Old1[j].Name);
for(k=0;k<i1;k++)
{
fprintf(fp,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fp);
for(k=0;k<i1;k++)
{
fprintf(fq,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fq);
}
}
else if(choice=='N')
break;
else
{
printf("输入有误,请重新输入:");
goto again1;
}
break;
}
}
if(!judge)
{
int judgement=1;
fp=fopen("E:\\EmployeeHH\\Employeemessage_Subtext.txt","r+");
while(fscanf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d",&Old2[i2].Number,Old2[i2].Name,Old2[i2].Sex,&Old2[i2].Age,&Old2[i2].Phonenumber,Old2[i2].job,&Old2[i2].Salary)==7)
i2++;
fclose(fp);
for(j=0;j<i2;j++)
{
if(number==Old2[j].Number)
{
judgement=1;
strcpy(Old1[i1].Name,Old2[j].Name);
Old1[i1].Number=Old2[j].Number;
break;
}
}
if(judgement)
{
printf("该员工当月还未进行评估!!!\n");
printf("请为该员工当月的第一次测评打分:");
scanf("%d",&stu.first);
Old1[i1].first=stu.first;
printf("请为该员工当月的第二次测评打分:");
scanf("%d",&stu.second);
Old1[i1].second=stu.second;
printf("请为该员工当月的第三次测评打分:");
scanf("%d",&stu.third);
Old1[i1].third=stu.third;
stu.final=( stu.first+stu.second+stu.third )/3;
Old1[i1].final=stu.final;
int t = Finalresult(stu.final);
fp=fopen("E:\\EmployeeHH\\Performance_evaluation_Positive_text.txt","w+");
fq=fopen("E:\\EmployeeHH\\Performance_evaluation_Subtext.txt","w+");
fputs("工号\t姓名 第一次测评评分 第二次测评评分 第三次测评评分 综合评分 评估等级\n",fp);
if(t==1)
{
strcpy(Old1[i1].grade,"优");
printf("该员工【%s】最后的评估等级为:【优】\n",Old1[i1].Name);
i1++;
for(k=0;k<i1;k++)
{
fprintf(fp,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fp);
for(k=0;k<i1;k++)
{
fprintf(fq,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fq);
}
else if(t==2)
{
strcpy(Old1[i1].grade,"良");
printf("该员工【%s】最后的评估等级为:【良】\n",Old1[i1].Name);
i1++;
for(k=0;k<i1;k++)
{
fprintf(fp,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fp);
for(k=0;k<i1;k++)
{
fprintf(fq,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fq);
}
else if(t==3)
{
strcpy(Old1[i1].grade,"一般");
printf("该员工【%s】最后的评估等级为:【一般】\n",Old1[i1].Name);
i1++;
for(k=0;k<i1;k++)
{
fprintf(fp,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fp);
for(k=0;k<i1;k++)
{
fprintf(fq,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fq);
}
else
{
strcpy(Old1[i1].grade,"差");
printf("该员工【%s】最后的评估等级为:【差】\n",Old1[i1].Name);
i1++;
for(k=0;k<i1;k++)
{
fprintf(fp,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fp);
for(k=0;k<i1;k++)
{
fprintf(fq,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fq);
}
}
}
else
{
printf("并未查询到工号为【%d】的员工!该员工不存在或工号输入有误!\n",number);
}
printf("是否还要进行员工绩效评估操作:(Y/N)");
char c;
getchar();
scanf("%c",&c);
if(c=='Y')
continue;
else
break;
}
}
2. 绩效查询:管理员可以查询员工的绩效评估结果。
//绩效查询
void Performance_queries()
{
while(1)
{
int judge1=0,judge2=0;
printf("======欢迎来到绩效查询界面======\n");
struct node Old1[100],stu;
struct Employee Old2[100];
int i1=0,i2=0,j,k;
FILE *fp,*fq;
fp=fopen("E:\\EmployeeHH\\Performance_evaluation_Subtext.txt","r+"); //副文本!!!!!!!!!!!!!!!!!
while(fscanf(fp,"%d %s %d %d %d %lf %s",&Old1[i1].Number,Old1[i1].Name,&Old1[i1].first,&Old1[i1].second,&Old1[i1].third,&Old1[i1].final,Old1[i1].grade)==7)
i1++;
fclose(fp);
fp=fopen("E:\\EmployeeHH\\Employeemessage_Subtext.txt","r+");
while(fscanf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d",&Old2[i2].Number,Old2[i2].Name,Old2[i2].Sex,&Old2[i2].Age,&Old2[i2].Phonenumber,Old2[i2].job,&Old2[i2].Salary)==7)
i2++;
fclose(fp);
int Number;
printf("请输入需要查询的员工工号:");
scanf("%d",&Number);
for(j=0;j<i1;j++)
{
if(Old1[j].Number==Number)
{
judge1=1;
printf("查询到该员工的绩效信息!其信息如下:\n");
printf("当月第一次测评评分为:%d\n",Old1[j].first);
printf("当月第二次测评评分为:%d\n",Old1[j].second);
printf("当月第三次测评评分为:%d\n",Old1[j].third);
printf("当月综合测评评分为:%.2lf\n",Old1[j].final);
printf("当月的评估等级为:%s\n",Old1[j].grade);
break;
}
}
if(!judge1)
{
for(j=0;j<i2;j++)
{
if(Old2[j].Number==Number)
{
judge2=1;
printf("查询到有该员工!该员工为【%s】,但并未查询到有该员工的绩效信息!!!\n",Old2[j].Name);
break;
}
}
}
if(!judge2&&!judge1)
printf("并未查询到有工号为【%d】的员工!!!!!!!\n",Number);
printf("是否还要进行员工绩效查询操作:(Y/N)");
char c;
getchar();
scanf("%c",&c);
if(c=='Y')
continue;
else
break;
}
}
//员工福利管理菜单
void employee_benefits_management()
{
while(1)
{
printf("***************************************************************\n");
printf("=================欢迎来到员工福利管理界面======================\n");
printf("\t1.福利发放\t2.福利查询\n\t3.退出\n");
printf("***************************************************************\n");
int choice;
printf("请输入你的选择:");
again:
scanf("%d",&choice);
if(choice==1)
{
Welfare_distribution();
}
else if(choice==2)
{
Benefits_Inquiry();
}
else if(choice==3)
{
system("cls");
break;
}
else
{
printf("输入有误,请重新输入:");
goto again;
}
}
}
1. 福利发放:管理员可以根据员工的工作表现和福利标准进行福利发放。
//福利发放
void Welfare_distribution()
{
while(1)
{
struct Welfare Old1[100];
struct node Old2[100];
struct Employee Old3[100];
struct Benefit Old4[100];
int i1=0,i2=0,i3=0,i4=0,j;
int judge1=0,judge2=0,judge3=0;
printf("=======欢迎来到福利发放界面============\n");
FILE *fp;
fp=fopen("E:\\EmployeeHH\\Welfare_distribution_Subtext.txt","r+"); //福利发放副文本
while(fscanf(fp,"%d %s %s %d %d",&Old1[i1].Number,Old1[i1].name,Old1[i1].grade,&Old1[i1].money,&Old1[i1].judge)==5)
i1++;
fclose(fp);
fp=fopen("E:\\EmployeeHH\\Performance_evaluation_Subtext.txt","r+"); //绩效评估副文本
while(fscanf(fp,"%d %s %d %d %d %lf %s",&Old2[i2].Number,Old2[i2].Name,&Old2[i2].first,&Old2[i2].second,&Old2[i2].third,&Old2[i2].final,Old2[i2].grade)==7)
i2++;
fclose(fp);
fp=fopen("E:\\EmployeeHH\\Employeemessage_Subtext.txt","r+"); //员工信息副文本
while(fscanf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d",&Old3[i3].Number,Old3[i3].Name,Old3[i3].Sex,&Old3[i3].Age,&Old3[i3].Phonenumber,Old3[i3].job,&Old3[i3].Salary)==7)
i3++;
fclose(fp);
fp=fopen("E:\\EmployeeHH\\benefits_inquiry.txt","r+"); //福利查询文本
while(fscanf(fp,"%s %d",Old4[i4].grade,&Old4[i4].bonus)==2)
i4++;
fclose(fp);
printf("请输入需要进行福利发放员工的工号:");
int num;
scanf("%d",&num);
for(j=0;j<i1;j++)
{
if(Old1[j].Number==num)
{
judge1=1;
printf("查询到该员工,该员工为【%s】!\n",Old1[j].name);
if(Old1[j].judge)
{
printf("\n该员工当月福利奖金【%d元】已发放!!!",Old1[j].money);
}
else
{
printf("\n该员工当月福利奖金【%d元】未发放!!!\n",Old1[j].money);
int choice;
printf("是否发放员工【%s】当月的福利奖金(1.是/2.否):",Old1[j].name);
again1:
scanf("%d",&choice);
if(choice==1)
{
Old1[j].judge=1;
printf("叮咚!!!!员工【%s】当月福利奖金【%d元】已发放!",Old1[j].name,Old1[j].money);
}
else if(choice==2)
{
Old1[j].judge=0;
printf("叮咚!!!!员工【%s】的福利奖金【%d元】暂不进行发放",Old1[j].name,Old1[j].money);
}
else
{
printf("输入有误!!!!!!!请重新输入:");
goto again1;
}
}
}
}
if(!judge1)
{
for(j=0;j<i2;j++)
{
if(Old2[j].Number==num)
{
judge2=1;
printf("查询到该员工,该员工为【%s】!\n",Old2[j].Name);
printf("该员工的福利奖金还未发放!!!!\n");
for(int k=0;k<i4;k++)
{
if(strcmp(Old2[j].grade,Old4[k].grade)==0)
{
printf("该员工当月的绩效评估等级为【%s】,应发放福利奖金【%d】\n",Old2[j].grade,Old4[k].bonus);
int choice;
printf("是否发放员工【%s】的福利奖金(1.是/2.否):",Old2[j].Name);
Old1[i1].Number=Old2[j].Number;
strcpy(Old1[i1].name,Old2[j].Name);
Old1[i1].money=Old4[k].bonus;
strcpy(Old1[i1].grade,Old2[j].grade);
again3:
scanf("%d",&choice);
if(choice==1)
{
Old1[i1].judge=1;
printf("叮咚!!!!员工【%s】的福利奖金【%d】已发放!!!!\n",Old2[j].Name,Old4[k].bonus);
}
else if(choice==2)
{
Old1[i1].judge=0;
printf("叮咚!!!!员工【%s】的福利奖金【%d元】暂不进行发放",Old2[j].Name,Old4[k].bonus);
}
else
{
printf("输入有误!!!!!!!请重新输入(1.是/2.否):");
goto again3;
}
i1++;
break;
}
}
break;
}
}
}
if(!judge1&&!judge2)
{
for(j=0;j<i3;j++)
{
if(Old3[j].Number==num)
{
judge3=1;
printf("查询到该员工!!!!该员工为:【%s】\n",Old3[j].Name);
printf("该员工当月尚未进行过绩效评估!需要先进行绩效评估后才可进行福利发放!!\n");
}
}
}
if(!judge1&&!judge2&&!judge3)
{
printf("并未查询到工号为【%d】的员工!!!该员工不存在或工号输入有误!\n");
}
fp=fopen("E:\\EmployeeHH\\Welfare_distribution_Subtext.txt","w+");
for(j=0;j<i1;j++)
{
fprintf(fp,"%d %s %s %d %d\n",Old1[j].Number,Old1[j].name,Old1[j].grade,Old1[j].money,Old1[j].judge);
}
fclose(fp);
fp=fopen("E:\\EmployeeHH\\Welfare_distribution_Positive_text.txt","w+");
fputs(" 工号\t姓名 评估等级 福利奖金 发放状态(1.是/2.否)\n",fp);
for(j=0;j<i1;j++)
{
fprintf(fp,"%d %s\t%s %d\t%d\n",Old1[j].Number,Old1[j].name,Old1[j].grade,Old1[j].money,Old1[j].judge);
}
fclose(fp);
printf("\n是否还要福利发放操作:(Y/N)");
char c;
getchar();
scanf("%c",&c);
if(c=='Y')
continue;
else
break;
}
}
2. 福利查询:管理员可以查询员工的福利信息。
//福利查询
void Benefits_Inquiry()
{
struct Benefit stu[10];
int i=0,j;
FILE *fp;
fp=fopen("E:\\EmployeeHH\\benefits_inquiry.txt","r+");
while(fscanf(fp,"%s %d",stu[i].grade,&stu[i].bonus)==2)
i++;
printf("=======欢迎来到福利查询界面============\n");
printf("=======福利详情如下=========\n");
for(j=0;j<i;j++)
{
printf("若该员工的绩效等级为【%s】,则可获得金额为【%d】的奖金\n",stu[j].grade,stu[j].bonus);
}
}
//员工推荐菜单
void employee_recommend()
{
while(1)
{
printf("***************************************************************\n");
printf("===================欢迎来到员工推荐界面========================\n");
printf("\t1.推荐职位\t2.推荐培训\n\t3.退出\n");
printf("***************************************************************\n");
int choice;
printf("请输入你的选择:");
again:
scanf("%d",&choice);
if(choice==1)
{
Recommended_positions();
}
else if(choice==2)
{
Recommended_training();
}
else if(choice==3)
{
system("cls");
break;
}
else
{
printf("输入有误,请重新输入:");
goto again;
}
}
}
1. 推荐职位:管理员可以根据员工的工作表现和职位需求进行智能推荐。
//推荐职位
void Recommended_positions()
{
struct training stu[10];
int i=0,j;
FILE *fp;
fp=fopen("E:\\EmployeeHH\\Recommended_positions.txt","r+");
while(fscanf(fp,"%s %s",stu[i].grade,stu[i].recommend)==2)
i++;
printf("=======欢迎来到推荐职位界面============\n");
printf("职位的推荐是根据员工的绩效评估等级来判定的\n");
for(j=0;j<i;j++)
{
printf("若员工绩效等级为【%s】,则推荐职位【%s】\n",stu[j].grade,stu[j].recommend);
}
}
2. 推荐培训:管理员可以根据员工的工作表现和培训需求进行智能推荐。
//推荐培训
void Recommended_training()
{
struct training stu[10];
int i=0,j;
FILE *fp;
fp=fopen("E:\\EmployeeHH\\Recommended_training.txt","r+");
while(fscanf(fp,"%s %s",stu[i].grade,stu[i].recommend)==2)
i++;
printf("=======欢迎来到推荐培训界面============\n");
printf("培训推荐是根据员工的绩效评估等级来判定的\n");
for(j=0;j<i;j++)
{
printf("若员工绩效等级为【%s】,则推荐【%s】\n",stu[j].grade,stu[j].recommend);
}
}
//休闲娱乐菜单
void entertainment()
{
printf("==================欢迎来到员工信息管理界面=====================\n\n");
printf("***************************************************************\n");
printf("\t1.玩游戏\t2.听音乐\n");
printf("\t3.退出\n");
printf("***************************************************************\n");
int choice;
printf("请输入您需要进行的操作:");
again:
scanf("%d",&choice);
if(choice==1)
{
printf("玩游戏!!\n");
system("cls");
}
else if(choice==2)
{
printf("听音乐");
system("cls");
}
else if(choice==3)
{
system("cls");
return;
}
else
{
printf("输入有误,请您重新输入:");
goto again;
}
}
休闲娱乐功能尚未完全完善,后期完全完善后将会重新更新本文,且休闲娱乐的玩游戏中会接入【读心术、走迷宫....】等游戏。
#include
typedef long long int ll;
struct Employee
{
int Number; //工号
char Name[250]; //姓名
char Sex[100]; //性别
int Age; //年龄
ll Phonenumber; //电话号码
char job[200]; //职位
int Salary; //基本工资
};
void Add(); //添加信息
void inquire();//查询信息
void Delete();//删除信息
void Modify();//修改信息
void Payroll_Management(); //薪资管理菜单
void Employee_Information_Management();//员工信息管理菜单
bool Isrepeated(int number); //判断工号是否重复
void personnel_performance_appraisal();//员工绩效评估菜单
void employee_benefits_management(); //员工福利管理菜单
void employee_recommend(); //员工推荐菜单
bool IsSix(); //判断工号是否为6位数
void payroll_is_paid(); //薪资发放
void Salary_enquiry(); //薪资查询
void Performance_evaluation(); //绩效评估
void Performance_queries(); //绩效查询
void Welfare_distribution(); //福利发放
void Benefits_Inquiry(); //福利查询
void Recommended_positions(); //推荐职位
void Recommended_training(); //推荐培训
int Finalresult(double a); //测试评估等级
void entertainment(); //休闲娱乐菜单
bool IsPhone(ll num); //判断手机号是否是11位
//主程序
int main()
{
while(1)
{
printf("=====================欢迎使用员工管理系统======================\n\n");
printf("***************************************************************\n");
printf("----------------1.员工信息管理\t2.薪资管理---------------------\n");
printf("----------------3.员工绩效评估\t4.员工福利管理-----------------\n");
printf("----------------5.推荐\t\t6.休闲娱乐-------------------------\n");
printf("----------------7.退出\t\t\t -------------------------\n");
printf("***************************************************************\n");
int choice;
printf("请输入你的选择:");
again:
scanf("%d",&choice);
switch (choice)
{
case 1:
system("cls");
Employee_Information_Management();
break;
case 2:
system("cls");
Payroll_Management();
break;
case 3:
system("cls");
personnel_performance_appraisal();
break;
case 4:
system("cls");
employee_benefits_management();
break;
case 5:
system("cls");
employee_recommend();
break;
case 7:
printf("已退出!!!!!!!!!!!感谢使用!!!!!!!!!");
return 0;
break;
case 6:
system("cls");
entertainment();
break;
default:
printf("输入有误,请您重新输入:");
goto again;
break;
}
}
}
//休闲娱乐菜单
void entertainment()
{
printf("==================欢迎来到员工信息管理界面=====================\n\n");
printf("***************************************************************\n");
printf("\t1.玩游戏\t2.听音乐\n");
printf("\t3.退出\n");
printf("***************************************************************\n");
int choice;
printf("请输入您需要进行的操作:");
again:
scanf("%d",&choice);
if(choice==1)
{
printf("玩游戏!!\n");
system("cls");
}
else if(choice==2)
{
printf("听音乐");
system("cls");
}
else if(choice==3)
{
system("cls");
return;
}
else
{
printf("输入有误,请您重新输入:");
goto again;
}
}
//员工信息管理菜单
void Employee_Information_Management()
{
while(1)
{
printf("==================欢迎来到员工信息管理界面=====================\n\n");
printf("***************************************************************\n");
printf("\t1.添加员工信息\t2.删除员工信息\n");
printf("\t3.修改员工信息\t4.查询员工信息\n\t5.退出\n");
printf("***************************************************************\n");
int choice;
printf("请输入您需要进行的操作:");
again:
scanf("%d",&choice);
if(choice==1)
{
Add();
system("cls");
}
else if(choice==2)
{
Delete();
system("cls");
}
else if(choice==3)
{
Modify();
}
else if(choice==4)
{
inquire();
system("cls");
}
else if(choice==5)
{
system("cls");
return;
}
else
{
printf("输入有误,请您重新输入:");
goto again;
}
}
}
//判断工号是否重复!!!!!!
bool Isrepeated(int number)
{
struct Employee Old[100];
int i=0,j;
FILE *fp;
fp=fopen("E:\\EmployeeHH\\Employeemessage.txt","r+");
while(fscanf(fp,"%d %s %s %d %d",&Old[i].Number,Old[i].Name,Old[i].Sex,&Old[i].Age,&Old[i].Salary)==5)
i++;
for(j=0;j<i;j++)
{
if(Old[j].Number==number)
return true;
}
return false;
}
//判断工号是否为6位数
bool IsSix(int num)
{
int count=0;
while(num)
{
num/=10;
count++;
}
if(count==6)
return true;
else
return false;
}
//判断手机号是否是11位
bool IsPhone(ll num)
{
int count=0;
while(num)
{
num/=10;
count++;
}
if(count==11)
return true;
else
return false;
}
struct Employee_Sheet
{
char position[200];
int Salary;
};
//给予员工职位
void Isposition(struct Employee *E,char name[200])
{
struct Employee_Sheet Old[100];
int i=0,j;
FILE *fp;
fp=fopen("E:\\EmployeeHH\\Job_Status_Sheet.txt","r+");
while(fscanf(fp,"%s %d",Old[i].position,&Old[i].Salary)==2)
i++;
fclose(fp);
for(j=0;j<i;j++)
{
if(strcmp(name,Old[j].position)==0)
{
strcpy(E->job,name);
E->Salary=Old[j].Salary;
return;
}
}
if(strcmp(name,"待定")==0)
{
strcpy(E->job,name);
E->Salary=0;
}
}
//添加!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
void Add()
{
while(1)
{
struct Employee Old[100],New;
int i=0,j;
FILE *fp;
fp=fopen("E:\\EmployeeHH\\Employeemessage_Subtext.txt","r+");
while(fscanf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d",&Old[i].Number,Old[i].Name,Old[i].Sex,&Old[i].Age,&Old[i].Phonenumber,Old[i].job,&Old[i].Salary)==7)
i++;
fclose(fp);
printf("请输入该员工的姓名:");
scanf("%s",New.Name);
printf("请输入该员工的性别(1.男/2.女):");
int choose;
again2:
scanf("%d",&choose);
if(choose==1)
{
strcpy(Old[i].Sex,"男");
}
else if(choose==2)
{
strcpy(Old[i].Sex,"女");
}
else
{
printf("输入有误,请重新输入:");
goto again2;
}
printf("请输入该员工的年龄:");
scanf("%d",&New.Age);
printf("请输入该员工的联系方式(手机号):");
again3:
scanf("%lld",&New.Phonenumber);
if(!IsPhone(New.Phonenumber))
{
printf("输入有误,手机号应为11位,请重新输入:");
goto again3;
}
char location[200];
printf("\t1.董事长\t2.总经理\n");
printf("\t3.总监\t4.经理\n");
printf("\t5.主管\t6.组长\n");
printf("\t7.员工\t8.待定\n");
int choice;
printf("请选择该员工的职位:");
scanf("%d",&choice);
switch(choice)
{
case 1:
strcpy(location,"董事长");
Isposition(&New,location);
break;
case 2:
strcpy(location,"总经理");
Isposition(&New,location);
break;
case 3:
strcpy(location,"总监");
Isposition(&New,location);
break;
case 4:
strcpy(location,"经理");
Isposition(&New,location);
break;
case 5:
strcpy(location,"主管");
Isposition(&New,location);
break;
case 6:
strcpy(location,"组长");
Isposition(&New,location);
break;
case 7:
strcpy(location,"员工");
Isposition(&New,location);
break;
case 8:
strcpy(location,"待定");
Isposition(&New,location);
break;
}
printf("请赋予该员工工号(6位数):");
again1:
scanf("%d",&New.Number);
if( Isrepeated(New.Number) )
{
printf("该工号已存在,请重新给予该员工工号:");
goto again1;
}
if(!IsSix(New.Number))
{
printf("工号应为6位数,请重新输入:");
goto again1;
}
printf("输入完毕,该员工信息已录入!");
strcpy(Old[i].Name,New.Name);
Old[i].Number=New.Number;
Old[i].Phonenumber=New.Phonenumber;
Old[i].Age=New.Age;
strcpy(Old[i].job,New.job);
Old[i].Salary=New.Salary;
i++;
fp=fopen("E:\\EmployeeHH\\Emoloyeemessage_Positive_text.txt","w+");
fputs("工号\t姓名\t性别\t年龄\t联系方式\t\t职位\t基本工资\n",fp);
for(j=0;j<i;j++)
{
fprintf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d\n",Old[j].Number,Old[j].Name,Old[j].Sex,Old[j].Age,Old[j].Phonenumber,Old[j].job,Old[j].Salary);
}
fclose(fp);
fp=fopen("E:\\EmployeeHH\\Employeemessage_Subtext.txt","w+");
for(j=0;j<i;j++)
{
fprintf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d\n",Old[j].Number,Old[j].Name,Old[j].Sex,Old[j].Age,Old[j].Phonenumber,Old[j].job,Old[j].Salary);
}
fclose(fp);
printf("\n是否还要录入员工信息:(Y/N)");
char c;
getchar();
scanf("%c",&c);
if(c=='Y')
continue;
else
break;
}
}
//删除!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
void Delete()
{
while(1)
{
struct Employee Old[100];
int i=0,j;
int Employee_num,Count=0;
FILE *fp;
fp=fopen("E:\\EmployeeHH\\Employeemessage_Subtext.txt","r+");
while(fscanf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d",&Old[i].Number,Old[i].Name,Old[i].Sex,&Old[i].Age,&Old[i].Phonenumber,Old[i].job,&Old[i].Salary)==7)
i++;
fclose(fp);
printf("请输入您需要删除员工的工号:");
scanf("%d",&Employee_num);
fp=fopen("E:\\EmployeeHH\\Emoloyeemessage_Positive_text.txt","w+");
fputs("工号\t姓名\t性别\t年龄\t联系方式\t\t职位\t基本工资\n",fp);
for(j=0;j<i;j++)
{
if(Old[j].Number!=Employee_num)
{
fprintf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d\n",Old[j].Number,Old[j].Name,Old[j].Sex,Old[j].Age,Old[j].Phonenumber,Old[j].job,Old[j].Salary);
Count++;
}
}
fclose(fp);
fp=fopen("E:\\EmployeeHH\\Employeemessage_Subtext.txt","w+");//副文本!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
for(j=0;j<i;j++)
{
if(Old[j].Number!=Employee_num)
{
fprintf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d\n",Old[j].Number,Old[j].Name,Old[j].Sex,Old[j].Age,Old[j].Phonenumber,Old[j].job,Old[j].Salary);
}
}
fclose(fp);
if(Count==i)
{
printf("\n未查询到工号为【%d】的员工,无法进行删除!",Employee_num);
}
else
printf("该员工信息已删除!");
printf("\n是否还要进行删除员工信息操作:(Y/N)");
char c;
getchar();
scanf("%c",&c);
if(c=='Y')
continue;
else
break;
}
}
//修改!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
void Modify()
{
while(1)
{
struct Employee Old[100],New;
int i=0,j,k;
int judge=0;
int num;
FILE *fp;
fp=fopen("E:\\EmployeeHH\\Employeemessage_Subtext.txt","r+");
while(fscanf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d",&Old[i].Number,Old[i].Name,Old[i].Sex,&Old[i].Age,&Old[i].Phonenumber,Old[i].job,&Old[i].Salary)==7)
i++;
fclose(fp);
printf("请输入需要修改信息的员工工号:");
scanf("%d",&num);
for(j=0;j<i;j++)
{
if(Old[j].Number==num)
{
printf("查询到该员工!\n");
judge=1;
printf("请选择需要修改的信息!!!!!\n");
printf("\t1.工号\t2.姓名\n");
printf("\t3.性别\t4.年龄\n");
printf("\t5.联系方式\t6.职位\n");
printf("\t7.退出\n");
printf("请输入你的选择:");
int choice;
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("请输入该员工的工号:");
scanf("%d",&New.Number);
Old[j].Number=New.Number;
break;
case 2:
printf("请输入该员工的姓名:");
scanf("%s",New.Name);
strcpy(Old[j].Name,New.Name);
break;
case 3:
printf("请输入该员工的性别:");
scanf("%s",New.Sex);
strcpy(Old[j].Sex,New.Sex);
break;
case 4:
printf("请输入该员工的年龄:");
scanf("%d",&New.Age);
Old[j].Age=New.Age;
break;
case 5:
printf("请输入该员工的联系方式:");
scanf("%lld",&New.Phonenumber);
Old[j].Phonenumber=New.Phonenumber;
break;
case 6:
{
printf("请选择该员工的职位:");
scanf("%s",New.job);
struct Employee_Sheet Olde[100];
int i=0,j;
FILE *fp;
fp=fopen("E:\\EmployeeHH\\Job_Status_Sheet.txt","r+");
while(fscanf(fp,"%s %d",Olde[i].position,&Olde[i].Salary)==2)
i++;
fclose(fp);
for(j=0;j<i;j++)
{
if(strcmp(New.Name,Olde[j].position)==0)
{
strcpy(Old[j].job,Olde[j].position);
Old[j].Salary=Olde[j].Salary;
return;
}
}
if(strcmp(New.job,"待定")==0)
{
strcpy(Old[j].job,New.job);
Old[j].Salary=0;
}
break;
}
case 7:
exit(0);
break;
}
fp=fopen("E:\\EmployeeHH\\Employeemessage_Subtext.txt","w+");
for(k=0;k<i;k++)
{
fprintf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d\n",Old[k].Number,Old[k].Name,Old[k].Sex,Old[k].Age,Old[k].Phonenumber,Old[k].job,Old[k].Salary);
}
fclose(fp);
fp=fopen("E:\\EmployeeHH\\Emoloyeemessage_Positive_text.txt","w+");
fputs("工号\t姓名\t性别\t年龄\t联系方式\t\t职位\t基本工资\n",fp);
for(k=0;k<i;k++)
{
fprintf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d\n",Old[k].Number,Old[k].Name,Old[k].Sex,Old[k].Age,Old[k].Phonenumber,Old[k].job,Old[k].Salary);
}
fclose(fp);
printf("修改成功!!!!!!");
break;
}
}
if(!judge)
{
printf("\n未查询到工号为【%d】的员工!\n",num);
break;
}
printf("\n是否还要进行修改员工信息操作:(Y/N)");
char c;
getchar();
scanf("%c",&c);
if(c=='Y')
continue;
else
break;
}
}
//查询!!!!!!!!!!!!!!!!!!!!!!!!
void inquire()
{
while(1)
{
struct Employee Old[100];
int i=0,j;
FILE *fp;
fp=fopen("E:\\EmployeeHH\\Employeemessage_Subtext.txt","r+");
while(fscanf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d",&Old[i].Number,Old[i].Name,Old[i].Sex,&Old[i].Age,&Old[i].Phonenumber,Old[i].job,&Old[i].Salary)==7)
i++;
fclose(fp);
printf("\t1.通过工号查询\t2.通过姓名查询\n");
printf("请选择查询的方式:");
int choice; //选择查询方式
int num; //员工工号
char name[50]; //员工姓名
again:
scanf("%d",&choice);
int judge=0;
if(choice==1)
{
printf("请输入员工工号:");
scanf("%d",&num);
for(j=0;j<i;j++)
{
if(Old[j].Number==num)
{
printf("【工号】:%d 【姓名】:%s 【性别】:%s\n【年龄】:%d 【联系方式】:%lld\n【职位】:%s【基本工资】:%d\n",Old[j].Number,Old[j].Name,Old[j].Sex,Old[j].Age,Old[j].Phonenumber,Old[j].job,Old[j].Salary);
judge=1;
}
}
if(!judge)
printf("未查询到工号为【%d】的员工\n",num);
}
else if(choice==2)
{
printf("请输入员工姓名:");
scanf("%s",name);
for(j=0;j<i;j++)
{
if(strcmp(Old[j].Name,name)==0)
{
printf("【工号】:%d 【姓名】:%s \n【性别】:%s\n【年龄】:%d 【联系方式】:%lld\n【职位】:%s【基本工资】:%d\n",Old[j].Number,Old[j].Name,Old[j].Sex,Old[j].Age,Old[j].Phonenumber,Old[j].job,Old[j].Salary);
judge=2;
}
}
if(!judge)
printf("未查询到姓名为【%s】的员工\n",name);
}
else
{
printf("输入有误,请重新输入:");
goto again;
}
printf("\n是否还要进行查询员工信息操作:(Y/N)");
char c;
getchar();
scanf("%c",&c);
if(c=='Y')
continue;
else
break;
}
}
//薪资管理菜单!!!!!!!!!!!!!!!!!!
void Payroll_Management()
{
while(1)
{
printf("====================欢迎来到薪资管理界面=======================\n");
printf("***************************************************************\n");
printf("\t1.薪资发放\t2.薪资查询\n\t3.退出\n");
printf("***************************************************************\n");
int choice;
printf("请输入您需要进行的操作:");
again:
scanf("%d",&choice);
if(choice==1)
{
payroll_is_paid();
system("cls");
}
else if(choice==2)
{
Salary_enquiry();
system("cls");
}
else if(choice==3)
{
system("cls");
return;
}
else
{
printf("输入有误,请您重新输入:");
goto again;
}
}
}
//员工薪资发放结构体
struct payment
{
int number;
char name[200];
int money;
int judge;
};
//员工测评结构体
struct node
{
int Number;
char Name[200];
int first;
int second;
int third;
double final=0;
char grade[200];
};
//薪资发放
void payroll_is_paid()
{
while(1)
{
struct payment Old1[100];
struct Employee Old2[100];
int i1=0,i2=0,j;
int judge1=0,judge2=0;
printf("======欢迎来到薪资发放界面======\n");
FILE *fp;
fp=fopen("E:\\EmployeeHH\\Payroll_Subtext.txt","r+");
while(fscanf(fp,"%d %s %d %d",&Old1[i1].number,Old1[i1].name,&Old1[i1].money,&Old1[i1].judge)==4)
i1++;
fclose(fp);
fp=fopen("E:\\EmployeeHH\\Employeemessage_Subtext.txt","r+");
while(fscanf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d",&Old2[i2].Number,Old2[i2].Name,Old2[i2].Sex,&Old2[i2].Age,&Old2[i2].Phonenumber,Old2[i2].job,&Old2[i2].Salary)==7)
i2++;
fclose(fp);
int num;
printf("请输入需要发放薪资的员工工号:");
scanf("%d",&num);
for(j=0;j<i1;j++)
{
if(Old1[j].number==num)
{
judge1=1;
printf("查询到该员工,该员工为【%s】",Old1[j].name);
if(Old1[j].judge)
{
printf("\n该员工当月薪资【%d元】已发!!!",Old1[j].money);
}
else
{
printf("\n该员工当月薪资【%d元】未发!!!\n",Old1[j].money);
int choice;
again1:
printf("是否发放员工【%s】当月的薪资(1.是/2.否):",Old1[j].name);
scanf("%d",&choice);
if(choice==1)
{
Old1[j].judge=1;
printf("叮咚!!!!员工【%s】当月薪资【%d元】已发放!",Old1[j].name,Old1[j].money);
}
else if(choice==2)
{
Old1[j].judge=0;
printf("叮咚!!!!员工【%s】的薪资【%d元】暂不进行发放",Old1[j].name,Old1[j].money);
}
else
{
printf("输入有误!!!!!!!请重新输入:");
goto again1;
}
}
break;
}
}
if(!judge1)
{
for(j=0;j<i2;j++)
{
if(Old2[j].Number==num)
{
judge2=1;
printf("查询到该员工,该员工为【%s】\n",Old2[j].Name);
printf("该员工当月薪资【%d】还未发放!!!\n",Old2[j].Salary);
int choice;
again2:
printf("是否发放员工【%s】当月的薪资(1.是/2.否):",Old1[j].name);
scanf("%d",&choice);
if(choice==1)
{
Old1[i1].number=num;
Old1[i1].money=Old2[j].Salary;
strcpy(Old1[i1].name,Old2[j].Name);
Old1[i1].judge=1;
printf("叮咚!!!!员工【%s】当月薪资【%d元】已发放!",Old2[j].Name,Old2[i1].Salary);
}
else if(choice==2)
{
Old1[i1].number=num;
Old1[i1].money=Old2[j].Salary;
strcpy(Old1[i1].name,Old2[j].Name);
Old1[i1].judge=0;
printf("叮咚!!!!员工【%s】的薪资【%d元】暂不进行发放",Old2[i1].Name,Old2[i1].Salary);
}
else
{
printf("输入有误!!!!!!!请重新输入:");
goto again2;
}
i1++;
break;
}
}
}
if(!judge1&&!judge2)
{
printf("并未查询到有工号为【%d】的员工!!!!\n",num);
}
fp=fopen("E:\\EmployeeHH\\Payroll_Subtext.txt","r+");
for(j=0;j<i1;j++)
{
fprintf(fp,"%d %s %d %d\n",Old1[j].number,Old1[j].name,Old1[j].money,Old1[j].judge);
}
fclose(fp);
fp=fopen("E:\\EmployeeHH\\Payroll_Positive_text.txt","r+");
fputs("工号\t姓名 应发薪资 发放状态(1.是/2.否)\n",fp);
for(j=0;j<i1;j++)
{
fprintf(fp,"%d %s %d\t%d\n",Old1[j].number,Old1[j].name,Old1[j].money,Old1[j].judge);
}
fclose(fp);
printf("\n是否还要薪资发放操作:(Y/N)");
char c;
getchar();
scanf("%c",&c);
if(c=='Y')
continue;
else
break;
}
}
//薪资查询
void Salary_enquiry()
{
while(1)
{
struct payment Old1[100];
struct Employee Old2[100];
int i1=0,i2=0,j;
int judge1=0,judge2=0;
FILE *fp;
fp=fopen("E:\\EmployeeHH\\Payroll_Subtext.txt","r+");
while(fscanf(fp,"%d %s %d %d",&Old1[i1].number,Old1[i1].name,&Old1[i1].money,&Old1[i1].judge)==4)
i1++;
fclose(fp);
fp=fopen("E:\\EmployeeHH\\Employeemessage_Subtext.txt","r+");
while(fscanf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d",&Old2[i2].Number,Old2[i2].Name,Old2[i2].Sex,&Old2[i2].Age,&Old2[i2].Phonenumber,Old2[i2].job,&Old2[i2].Salary)==7)
i2++;
fclose(fp);
printf("======欢迎来到薪资管理界面======\n");
int num;
printf("请输入需要查询薪资的员工工号:");
scanf("%d",&num);
for(j=0;j<i1;j++)
{
if(Old1[j].number==num)
{
judge1=1;
printf("查询到员工【%s】的薪资信息!!其信息如下:\n",Old1[j].name);
if(Old1[j].judge==1)
{
printf("【工号】:%d 【姓名】:%s 【应发薪资】:%d 【发放状态】:已发放",Old1[j].number,Old1[j].name,Old1[j].money);
}
else
{
printf("【工号】:%d 【姓名】:%s 【应发薪资】:%d 【发放状态】:未发放",Old1[j].number,Old1[j].name,Old1[j].money);
}
break;
}
}
if(!judge1)
{
for(j=0;j<i2;j++)
{
if(Old2[j].Number==num)
{
judge2=1;
printf("查询到员工【%s】的薪资信息!!其信息如下:\n",Old2[j].Name);
printf("【工号】:%d 【姓名】:%s 【应发薪资】:%d 【发放状态】:未发放",Old2[j].Number,Old2[j].Name,Old2[j].Salary);
break;
}
}
}
if(!judge1&&!judge2)
{
printf("并未查询到有工号为【%d】的员工!!!!\n",num);
}
printf("\n是否还要薪资查询操作:(Y/N)");
char c;
getchar();
scanf("%c",&c);
if(c=='Y')
continue;
else
break;
}
}
//员工绩效评估菜单
void personnel_performance_appraisal()
{
while(1)
{
printf("***************************************************************\n");
printf("=================欢迎来到员工绩效评估界面======================\n");
printf("\t1.绩效评估\t2.绩效查询\n\t3.退出\n");
printf("***************************************************************\n");
int choice;
printf("请输入你的选择:");
again:
scanf("%d",&choice);
if(choice==1)
{
Performance_evaluation();
system("cls");
}
else if(choice==2)
{
Performance_queries();
system("cls");
}
else if(choice==3)
{
system("cls");
return;
}
else
{
printf("输入有误,请重新输入:");
goto again;
}
}
}
//评估等级
int Finalresult(double a)
{
if(a>=80)
return 1;
else if(a>=70)
return 2;
else if(a>=60)
return 3;
else
return 4;
}
//绩效评估
void Performance_evaluation()
{
while(1)
{
struct node Old1[100],stu;
struct Employee Old2[100];
int i1=0,i2=0,j,k;
FILE *fp,*fq;
fp=fopen("E:\\EmployeeHH\\Performance_evaluation_Subtext.txt","r+"); //副文本!!!!!!!!!!!!!!!!!
while(fscanf(fp,"%d %s %d %d %d %lf %s",&Old1[i1].Number,Old1[i1].Name,&Old1[i1].first,&Old1[i1].second,&Old1[i1].third,&Old1[i1].final,Old1[i1].grade)==7)
i1++;
fclose(fp);
int number;
int judge=0;
printf("======欢迎来到绩效评估界面======\n");
printf("请输入你要评估员工的工号:");
scanf("%d",&number);
for(j=0;j<i1;j++)
{
if(number==Old1[j].Number)
{
judge=1;
char choice;
struct node stu;
printf("该员工【%s】当月已进行过评估!\n",Old1[j].Name);
printf("其评估信息为:\n");
printf("当月第一次测评评分为:%d\n",Old1[j].first);
printf("当月第二次测评评分为:%d\n",Old1[j].second);
printf("当月第三次测评评分为:%d\n",Old1[j].third);
printf("当月综合测评评分为:%.2lf\n",Old1[j].final);
printf("当月的评估等级为:%s\n",Old1[j].grade);
printf("是否需要对其重新进行评估(Y/N):");
getchar();
again1:
scanf("%c",&choice);
if(choice=='Y')
{
printf("请为该员工当月的第一次测评打分:");
scanf("%d",&stu.first);
Old1[j].first=stu.first;
printf("请为该员工当月的第二次测评打分:");
scanf("%d",&stu.second);
Old1[j].second=stu.second;
printf("请为该员工当月的第三次测评打分:");
scanf("%d",&stu.third);
Old1[j].third=stu.third;
stu.final=( stu.first+stu.second+stu.third )/3;
Old1[j].final=stu.final;
int t = Finalresult(stu.final);
fp=fopen("E:\\EmployeeHH\\Performance_evaluation_Positive_text.txt","w+");
fq=fopen("E:\\EmployeeHH\\Performance_evaluation_Subtext.txt","w+");
fputs("工号\t姓名 第一次测评评分 第二次测评评分 第三次测评评分 综合评分 评估等级\n",fp);
if(t==1)
{
strcpy(Old1[j].grade,"优");
printf("该员工【%s】最后的评估等级为:【优】\n",Old1[j].Name);
for(k=0;k<i1;k++)
{
fprintf(fp,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fp);
for(k=0;k<i1;k++)
{
fprintf(fq,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fq);
}
else if(t==2)
{
strcpy(Old1[j].grade,"良");
printf("该员工【%s】最后的评估等级为:【良】\n",Old1[j].Name);
for(k=0;k<i1;k++)
{
fprintf(fp,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fp);
for(k=0;k<i1;k++)
{
fprintf(fq,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fq);
}
else if(t==3)
{
strcpy(Old1[j].grade,"一般");
printf("该员工【%s】最后的评估等级为:【一般】\n",Old1[j].Name);
for(k=0;k<i1;k++)
{
fprintf(fp,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fp);
for(k=0;k<i1;k++)
{
fprintf(fq,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fq);
}
else
{
strcpy(Old1[j].grade,"差");
printf("该员工【%s】最后的评估等级为:【差】\n",Old1[j].Name);
for(k=0;k<i1;k++)
{
fprintf(fp,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fp);
for(k=0;k<i1;k++)
{
fprintf(fq,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fq);
}
}
else if(choice=='N')
break;
else
{
printf("输入有误,请重新输入:");
goto again1;
}
break;
}
}
if(!judge)
{
int judgement=1;
fp=fopen("E:\\EmployeeHH\\Employeemessage_Subtext.txt","r+");
while(fscanf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d",&Old2[i2].Number,Old2[i2].Name,Old2[i2].Sex,&Old2[i2].Age,&Old2[i2].Phonenumber,Old2[i2].job,&Old2[i2].Salary)==7)
i2++;
fclose(fp);
for(j=0;j<i2;j++)
{
if(number==Old2[j].Number)
{
judgement=1;
strcpy(Old1[i1].Name,Old2[j].Name);
Old1[i1].Number=Old2[j].Number;
break;
}
}
if(judgement)
{
printf("该员工当月还未进行评估!!!\n");
printf("请为该员工当月的第一次测评打分:");
scanf("%d",&stu.first);
Old1[i1].first=stu.first;
printf("请为该员工当月的第二次测评打分:");
scanf("%d",&stu.second);
Old1[i1].second=stu.second;
printf("请为该员工当月的第三次测评打分:");
scanf("%d",&stu.third);
Old1[i1].third=stu.third;
stu.final=( stu.first+stu.second+stu.third )/3;
Old1[i1].final=stu.final;
int t = Finalresult(stu.final);
fp=fopen("E:\\EmployeeHH\\Performance_evaluation_Positive_text.txt","w+");
fq=fopen("E:\\EmployeeHH\\Performance_evaluation_Subtext.txt","w+");
fputs("工号\t姓名 第一次测评评分 第二次测评评分 第三次测评评分 综合评分 评估等级\n",fp);
if(t==1)
{
strcpy(Old1[i1].grade,"优");
printf("该员工【%s】最后的评估等级为:【优】\n",Old1[i1].Name);
i1++;
for(k=0;k<i1;k++)
{
fprintf(fp,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fp);
for(k=0;k<i1;k++)
{
fprintf(fq,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fq);
}
else if(t==2)
{
strcpy(Old1[i1].grade,"良");
printf("该员工【%s】最后的评估等级为:【良】\n",Old1[i1].Name);
i1++;
for(k=0;k<i1;k++)
{
fprintf(fp,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fp);
for(k=0;k<i1;k++)
{
fprintf(fq,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fq);
}
else if(t==3)
{
strcpy(Old1[i1].grade,"一般");
printf("该员工【%s】最后的评估等级为:【一般】\n",Old1[i1].Name);
i1++;
for(k=0;k<i1;k++)
{
fprintf(fp,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fp);
for(k=0;k<i1;k++)
{
fprintf(fq,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fq);
}
else
{
strcpy(Old1[i1].grade,"差");
printf("该员工【%s】最后的评估等级为:【差】\n",Old1[i1].Name);
i1++;
for(k=0;k<i1;k++)
{
fprintf(fp,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fp);
for(k=0;k<i1;k++)
{
fprintf(fq,"%d %s \t%d\t \t%d\t \t%d\t %.2lf\t %s\n\n",Old1[k].Number,Old1[k].Name,Old1[k].first,Old1[k].second,Old1[k].third,Old1[k].final,Old1[k].grade);
}
fclose(fq);
}
}
}
else
{
printf("并未查询到工号为【%d】的员工!该员工不存在或工号输入有误!\n",number);
}
printf("是否还要进行员工绩效评估操作:(Y/N)");
char c;
getchar();
scanf("%c",&c);
if(c=='Y')
continue;
else
break;
}
}
//绩效查询
void Performance_queries()
{
while(1)
{
int judge1=0,judge2=0;
printf("======欢迎来到绩效查询界面======\n");
struct node Old1[100],stu;
struct Employee Old2[100];
int i1=0,i2=0,j,k;
FILE *fp,*fq;
fp=fopen("E:\\EmployeeHH\\Performance_evaluation_Subtext.txt","r+"); //副文本!!!!!!!!!!!!!!!!!
while(fscanf(fp,"%d %s %d %d %d %lf %s",&Old1[i1].Number,Old1[i1].Name,&Old1[i1].first,&Old1[i1].second,&Old1[i1].third,&Old1[i1].final,Old1[i1].grade)==7)
i1++;
fclose(fp);
fp=fopen("E:\\EmployeeHH\\Employeemessage_Subtext.txt","r+");
while(fscanf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d",&Old2[i2].Number,Old2[i2].Name,Old2[i2].Sex,&Old2[i2].Age,&Old2[i2].Phonenumber,Old2[i2].job,&Old2[i2].Salary)==7)
i2++;
fclose(fp);
int Number;
printf("请输入需要查询的员工工号:");
scanf("%d",&Number);
for(j=0;j<i1;j++)
{
if(Old1[j].Number==Number)
{
judge1=1;
printf("查询到该员工的绩效信息!其信息如下:\n");
printf("当月第一次测评评分为:%d\n",Old1[j].first);
printf("当月第二次测评评分为:%d\n",Old1[j].second);
printf("当月第三次测评评分为:%d\n",Old1[j].third);
printf("当月综合测评评分为:%.2lf\n",Old1[j].final);
printf("当月的评估等级为:%s\n",Old1[j].grade);
break;
}
}
if(!judge1)
{
for(j=0;j<i2;j++)
{
if(Old2[j].Number==Number)
{
judge2=1;
printf("查询到有该员工!该员工为【%s】,但并未查询到有该员工的绩效信息!!!\n",Old2[j].Name);
break;
}
}
}
if(!judge2&&!judge1)
printf("并未查询到有工号为【%d】的员工!!!!!!!\n",Number);
printf("是否还要进行员工绩效查询操作:(Y/N)");
char c;
getchar();
scanf("%c",&c);
if(c=='Y')
continue;
else
break;
}
}
//员工福利管理菜单
void employee_benefits_management()
{
while(1)
{
printf("***************************************************************\n");
printf("=================欢迎来到员工福利管理界面======================\n");
printf("\t1.福利发放\t2.福利查询\n\t3.退出\n");
printf("***************************************************************\n");
int choice;
printf("请输入你的选择:");
again:
scanf("%d",&choice);
if(choice==1)
{
Welfare_distribution();
}
else if(choice==2)
{
Benefits_Inquiry();
}
else if(choice==3)
{
system("cls");
break;
}
else
{
printf("输入有误,请重新输入:");
goto again;
}
}
}
//评估等级对应的福利奖金
struct Benefit
{
char grade[200];
int bonus;
};
//员工的福利结构体
struct Welfare
{
int Number;
char name[200];
char grade[200];
int money;
int judge;
};
//福利发放
void Welfare_distribution()
{
while(1)
{
struct Welfare Old1[100];
struct node Old2[100];
struct Employee Old3[100];
struct Benefit Old4[100];
int i1=0,i2=0,i3=0,i4=0,j;
int judge1=0,judge2=0,judge3=0;
printf("=======欢迎来到福利发放界面============\n");
FILE *fp;
fp=fopen("E:\\EmployeeHH\\Welfare_distribution_Subtext.txt","r+"); //福利发放副文本
while(fscanf(fp,"%d %s %s %d %d",&Old1[i1].Number,Old1[i1].name,Old1[i1].grade,&Old1[i1].money,&Old1[i1].judge)==5)
i1++;
fclose(fp);
fp=fopen("E:\\EmployeeHH\\Performance_evaluation_Subtext.txt","r+"); //绩效评估副文本
while(fscanf(fp,"%d %s %d %d %d %lf %s",&Old2[i2].Number,Old2[i2].Name,&Old2[i2].first,&Old2[i2].second,&Old2[i2].third,&Old2[i2].final,Old2[i2].grade)==7)
i2++;
fclose(fp);
fp=fopen("E:\\EmployeeHH\\Employeemessage_Subtext.txt","r+"); //员工信息副文本
while(fscanf(fp,"%d %s\t%s\t%d\t%lld\t%s\t%d",&Old3[i3].Number,Old3[i3].Name,Old3[i3].Sex,&Old3[i3].Age,&Old3[i3].Phonenumber,Old3[i3].job,&Old3[i3].Salary)==7)
i3++;
fclose(fp);
fp=fopen("E:\\EmployeeHH\\benefits_inquiry.txt","r+"); //福利查询文本
while(fscanf(fp,"%s %d",Old4[i4].grade,&Old4[i4].bonus)==2)
i4++;
fclose(fp);
printf("请输入需要进行福利发放员工的工号:");
int num;
scanf("%d",&num);
for(j=0;j<i1;j++)
{
if(Old1[j].Number==num)
{
judge1=1;
printf("查询到该员工,该员工为【%s】!\n",Old1[j].name);
if(Old1[j].judge)
{
printf("\n该员工当月福利奖金【%d元】已发放!!!",Old1[j].money);
}
else
{
printf("\n该员工当月福利奖金【%d元】未发放!!!\n",Old1[j].money);
int choice;
printf("是否发放员工【%s】当月的福利奖金(1.是/2.否):",Old1[j].name);
again1:
scanf("%d",&choice);
if(choice==1)
{
Old1[j].judge=1;
printf("叮咚!!!!员工【%s】当月福利奖金【%d元】已发放!",Old1[j].name,Old1[j].money);
}
else if(choice==2)
{
Old1[j].judge=0;
printf("叮咚!!!!员工【%s】的福利奖金【%d元】暂不进行发放",Old1[j].name,Old1[j].money);
}
else
{
printf("输入有误!!!!!!!请重新输入:");
goto again1;
}
}
}
}
if(!judge1)
{
for(j=0;j<i2;j++)
{
if(Old2[j].Number==num)
{
judge2=1;
printf("查询到该员工,该员工为【%s】!\n",Old2[j].Name);
printf("该员工的福利奖金还未发放!!!!\n");
for(int k=0;k<i4;k++)
{
if(strcmp(Old2[j].grade,Old4[k].grade)==0)
{
printf("该员工当月的绩效评估等级为【%s】,应发放福利奖金【%d】\n",Old2[j].grade,Old4[k].bonus);
int choice;
printf("是否发放员工【%s】的福利奖金(1.是/2.否):",Old2[j].Name);
Old1[i1].Number=Old2[j].Number;
strcpy(Old1[i1].name,Old2[j].Name);
Old1[i1].money=Old4[k].bonus;
strcpy(Old1[i1].grade,Old2[j].grade);
again3:
scanf("%d",&choice);
if(choice==1)
{
Old1[i1].judge=1;
printf("叮咚!!!!员工【%s】的福利奖金【%d】已发放!!!!\n",Old2[j].Name,Old4[k].bonus);
}
else if(choice==2)
{
Old1[i1].judge=0;
printf("叮咚!!!!员工【%s】的福利奖金【%d元】暂不进行发放",Old2[j].Name,Old4[k].bonus);
}
else
{
printf("输入有误!!!!!!!请重新输入(1.是/2.否):");
goto again3;
}
i1++;
break;
}
}
break;
}
}
}
if(!judge1&&!judge2)
{
for(j=0;j<i3;j++)
{
if(Old3[j].Number==num)
{
judge3=1;
printf("查询到该员工!!!!该员工为:【%s】\n",Old3[j].Name);
printf("该员工当月尚未进行过绩效评估!需要先进行绩效评估后才可进行福利发放!!\n");
}
}
}
if(!judge1&&!judge2&&!judge3)
{
printf("并未查询到工号为【%d】的员工!!!该员工不存在或工号输入有误!\n");
}
fp=fopen("E:\\EmployeeHH\\Welfare_distribution_Subtext.txt","w+");
for(j=0;j<i1;j++)
{
fprintf(fp,"%d %s %s %d %d\n",Old1[j].Number,Old1[j].name,Old1[j].grade,Old1[j].money,Old1[j].judge);
}
fclose(fp);
fp=fopen("E:\\EmployeeHH\\Welfare_distribution_Positive_text.txt","w+");
fputs(" 工号\t姓名 评估等级 福利奖金 发放状态(1.是/2.否)\n",fp);
for(j=0;j<i1;j++)
{
fprintf(fp,"%d %s\t%s %d\t%d\n",Old1[j].Number,Old1[j].name,Old1[j].grade,Old1[j].money,Old1[j].judge);
}
fclose(fp);
printf("\n是否还要福利发放操作:(Y/N)");
char c;
getchar();
scanf("%c",&c);
if(c=='Y')
continue;
else
break;
}
}
//福利查询
void Benefits_Inquiry()
{
struct Benefit stu[10];
int i=0,j;
FILE *fp;
fp=fopen("E:\\EmployeeHH\\benefits_inquiry.txt","r+");
while(fscanf(fp,"%s %d",stu[i].grade,&stu[i].bonus)==2)
i++;
printf("=======欢迎来到福利查询界面============\n");
printf("=======福利详情如下=========\n");
for(j=0;j<i;j++)
{
printf("若该员工的绩效等级为【%s】,则可获得金额为【%d】的奖金\n",stu[j].grade,stu[j].bonus);
}
}
//员工推荐菜单
void employee_recommend()
{
while(1)
{
printf("***************************************************************\n");
printf("===================欢迎来到员工推荐界面========================\n");
printf("\t1.推荐职位\t2.推荐培训\n\t3.退出\n");
printf("***************************************************************\n");
int choice;
printf("请输入你的选择:");
again:
scanf("%d",&choice);
if(choice==1)
{
Recommended_positions();
}
else if(choice==2)
{
Recommended_training();
}
else if(choice==3)
{
system("cls");
break;
}
else
{
printf("输入有误,请重新输入:");
goto again;
}
}
}
struct training
{
char grade[200];
char recommend[1001];
};
//推荐职位
void Recommended_positions()
{
struct training stu[10];
int i=0,j;
FILE *fp;
fp=fopen("E:\\EmployeeHH\\Recommended_positions.txt","r+");
while(fscanf(fp,"%s %s",stu[i].grade,stu[i].recommend)==2)
i++;
printf("=======欢迎来到推荐职位界面============\n");
printf("职位的推荐是根据员工的绩效评估等级来判定的\n");
for(j=0;j<i;j++)
{
printf("若员工绩效等级为【%s】,则推荐职位【%s】\n",stu[j].grade,stu[j].recommend);
}
}
//推荐培训
void Recommended_training()
{
struct training stu[10];
int i=0,j;
FILE *fp;
fp=fopen("E:\\EmployeeHH\\Recommended_training.txt","r+");
while(fscanf(fp,"%s %s",stu[i].grade,stu[i].recommend)==2)
i++;
printf("=======欢迎来到推荐培训界面============\n");
printf("培训推荐是根据员工的绩效评估等级来判定的\n");
for(j=0;j<i;j++)
{
printf("若员工绩效等级为【%s】,则推荐【%s】\n",stu[j].grade,stu[j].recommend);
}
}