#include"WorkerSalary.h"
status ProvePeople(LinkList L,char account[],char password[])
{
int i;
LinkList q;
q=L->next;
while(q)
{
if(strcmp(q->data.account,account)==0 && strcmp(q->data.password,password)==0)
{
printf("*******************************************\n");
printf("* 你好!%4s...*\n",q->data.name);
printf("* 用户界面 *\n");
return 1;
}
q=q->next;
}
printf("用户名或密码错误!\n");
return 0;
}
void CreatListPreson(PreLinkList &P) //创建链表L
{
time_t ltime;
struct tm *today;
time( <ime );
today = localtime( <ime );
int i,n,j,sum,count;
char k,str[11];
printf("请输入录入员工的个数:");
scanf("%d",&n);
P=new PersonNode;
PreLinkList r,p,q;
P->next=NULL;
r=P;
for(count=0;count<n;count++)
{
q=new PersonNode;
printf("请输入员工编号:");
scanf("%s",&q->data.number);
printf("请输入员工姓名:");
scanf("%s",&q->data.name);
printf("请输入员工级别(职称):");
scanf("%s",&q->data.rank);
printf("请输入员工月工资:");
scanf("%lf",&q->data.Salary.wage);
printf("请输入员工补贴:");
scanf("%lf",&q->data.Salary.subsidy);
printf("请输入员工年终奖:");
scanf("%lf",&q->data.award);
if(q->data.Salary.wage<=2000)
q->data.Salary.tax=0;
else if(q->data.Salary.wage>5000)
q->data.Salary.tax=(q->data.Salary.wage-2000)*0.1;
else
q->data.Salary.tax=(q->data.Salary.wage-2000)*0.05;
q->data.lastwage=(q->data.Salary.wage - q->data.Salary.tax + q->data.Salary.subsidy)*12+q->data.award;
sum=(1900+today->tm_year)*10000+(today->tm_mon+1)*100+today->tm_mday;
sprintf(str,"%d",sum);
j=0;
for(i=0;str[i]!='\0';i++)
{
if(i==4 || i==6 )
{
q->data.date[j++]='/';
}
q->data.date[j++]=str[i];
}
q->data.date[j]='\0';
q->next=NULL;
r->next=q;
r=q;
printf("\n");
}
printf("录入成功!\n");
//EnFilePerson(P);
}
void EditListPreson(PreLinkList &P) //按对员工工资进行修改
{
PreLinkList r;
r=P->next;
int data,flag=0,i=1;
char name[20];
char rank[15];
char number[10];
double wage;
double subsidy;
double award;
printf("请输入要修改的员工名字: ");
scanf("%s",name);
getchar();
while(r)
{
if(strcmp((r->data.name),name))
{
r=r->next;
i++;
}
else
break;
}
if(r==NULL)//||(i>count)
printf("ERROR!\n");
else
{
/*
printf("是否修改职工姓名?\n");
printf("1.修改 2.不修改\n");
scanf("%d",&data);
switch(data)
{
case 1:{
printf("请输入修改后的职工姓名:");
scanf("%s",name);
strcpy((r->data.name),name);
};break;
case 2:break;
}
*/
printf("是否修改职工等级?\n");
printf("1.修改 2.不修改\n");
scanf("%d",&data);
switch(data)
{
case 1:{
printf("请输入修改后的职工等级:");
scanf("%s",rank);
strcpy((r->data.rank),rank);
};break;
case 2:break;
}
printf("是否修改职工编号?\n");
printf("1.修改 2.不修改\n");
scanf("%d",&data);
switch(data)
{
case 1:{
printf("请输入修改后的职工编号:");
scanf("%s",number);
strcpy((r->data.number),number);
};break;
case 2:break;
}
printf("是否修改职工月工资?\n");
printf("1.修改 2.不修改\n");
scanf("%d",&data);
switch(data)
{
case 1:{
printf("请输入修改后的职工月工资:");
scanf("%lf",&wage);
r->data.Salary.wage=wage;
};break;
case 2:break;
}
printf("是否修改职工月补贴?\n");
printf("1.修改 2.不修改\n");
scanf("%d",&data);
switch(data)
{
case 1:{
printf("请输入修改后的职工月补贴:");
scanf("%lf",&subsidy);
r->data.Salary.subsidy=subsidy;
};break;
case 2:break;
}
printf("是否修改职工年终奖?\n");
printf("1.修改 2.不修改\n");
scanf("%d",&data);
switch(data)
{
case 1:{
printf("请输入修改后的职工年终奖:");
scanf("%lf",&award);
r->data.award=award;
};break;
case 2:break;
}
if(r->data.Salary.wage<=2000)
r->data.Salary.tax=0;
else if(r->data.Salary.wage>5000)
r->data.Salary.tax=(r->data.Salary.wage-2000)*0.1;
else
r->data.Salary.tax=(r->data.Salary.wage-2000)*0.05;
r->data.lastwage=(r->data.Salary.wage - r->data.Salary.tax + r->data.Salary.subsidy)*12+r->data.award;
printf("修改职工信息成功!\n");
}
}
void InListPreson(PreLinkList &P) //将一个员工的工资信息插入表中
{
time_t ltime;
struct tm *today;
time( <ime );
today = localtime( <ime );
PreLinkList r,s;
PersonSalary e;
int i,j=0,sum;
char name[20];
char rank[15];
char number[10];
double wage;
double subsidy;
double award;
double tax;
char str[11];
printf("请输入要增加的员工编号:");
scanf("%s",&e.number);
printf("请输入要增加的员工姓名:");
scanf("%s",&e.name);
printf("请输入要增加的员工级别(职称):");
scanf("%s",&e.rank);
printf("请输入要增加的员工月工资:");
scanf("%lf",&e.Salary.wage);
printf("请输入要增加的员工补贴:");
scanf("%lf",&e.Salary.subsidy);
printf("请输入要增加的员工年终奖:");
scanf("%lf",&e.award);
/*
sum=(1900+today->tm_year)*10000+(today->tm_mon+1)*100+today->tm_mday;
sprintf(str,"%d",sum);
j=0;
for(i=0;str[i]!='\0';i++)
{
if(i==4 || i==6 )
{
r->data.date[j++]='/';
}
r->data.date[j++]=str[i];
}
r->data.date[j]='\0';
*/
r=P;
while(r->next)
r=r->next; //寻找最后一个结点
s=new PersonNode; //生成新结点s
strcpy(s->data.name,e.name);
strcpy(s->data.rank,e.rank);
strcpy(s->data.number,e.number);
s->data.Salary.wage=e.Salary.wage;
s->data.Salary.subsidy=e.Salary.subsidy;
s->data.award=e.award;
if(s->data.Salary.wage<=2000)
s->data.Salary.tax=0;
else if(s->data.Salary.wage>5000)
s->data.Salary.tax=(s->data.Salary.wage-2000)*0.1;
else
s->data.Salary.tax=(s->data.Salary.wage-2000)*0.05;
s->data.lastwage=(s->data.Salary.wage - s->data.Salary.tax + s->data.Salary.subsidy)*12+s->data.award;
printf("插入职工信息成功!\n");
sum=(1900+today->tm_year)*10000+(today->tm_mon+1)*100+today->tm_mday;
sprintf(str,"%d",sum);
j=0;
for(i=0;str[i]!='\0';i++)
{
if(i==4 || i==6 )
{
r->data.date[j++]='/';
}
r->data.date[j++]=str[i];
}
r->data.date[j]='\0';
s->next=r->next;
r->next=s;
}
void DeleteListPreson(PreLinkList &P) //删除指定员工信息
{
PreLinkList r,s;
r=P;
int j=0;
PersonSalary e;
int i;
printf("请输入你要删除的位置:");
scanf("%d",&i);
while(r&&j<i-1)
{
r=r->next;
j++;
}
s=r->next;//此时s即为第i个结点
r->next=s->next;//令r指向第i个结点的下一个结点
e.Salary.wage=s->data.Salary.wage;
e.Salary.subsidy=s->data.Salary.subsidy;
e.award=s->data.award;
/*
strcpy(L->data.name,s->data.name);
strcpy(L->data.rank,s->data.rank);
strcpy(L->data.number,s->data.number);
L->data.Salary.wage=s->data.Salary.wage;
L->data.Salary.subsidy=s->data.Salary.subsidy;
L->data.Salary.award=s->data.Salary.award;
*/
delete s;//删除第i个结点
printf("删除成功!\n");
}
void AverSalRankPersonCount(PreLinkList P)
{
PreLinkList L,r,q,k;
L=P;
double sum;
int count;
q=P->next;
//r=L->next;
L=new PersonNode;
k=L;
while(q)
{
r=new PersonNode;
r->data=q->data;
k->next=r;
r->next=NULL;
k=r;
q=q->next;
}
q=L->next;
while(q)
{
sum=0.0;
count=1;
r=q->next;
if(q->data.number[0]!='\0')
{
sum=q->data.lastwage;
while(r)
{
if(strcmp(r->data.rank,q->data.rank)==0 && r->data.number[
甘志强
- 粉丝: 70
- 资源: 15
最新资源
- 2018年对口升学信息一类第一次联考试题(卷).doc
- 见证时代变迁的高考作文题.doc
- 江苏兴化一中2018年高考第四次模拟考试语文试题整理.doc
- 建筑试题3[识图答案].doc
- 静载检测技术基础理论考试(员)C.doc
- 跨境电商人才初级认证试题以与答案.doc
- 临床的护理文书规范模拟考试标准答案09_8_7.doc
- 垃圾分类知识问答.doc
- 六年级英语上[下册]知识点总结.doc
- 六年级写字教学案.doc
- 农业区位因素教学设计.doc
- 牛津译林版2018年_2018年学年8A英语期末专题练习_首字母填空.doc
- 人版小学数学六年级(下册)第3单元圆柱与圆锥教案.doc
- 巧用多媒体有效地复习有丝分裂和减数分裂考点.doc
- 人民教育出版社五年级语文(下册)易错字易错音.doc
- 山东省医学继续教育公共课程急诊及急救答案.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈