📄 menu2-input.cpp
字号:
int menue2(); /*input*/
{
int xk,yk;
int state=0;
char *sectionname[10];
char *workname[10];
char *salary[10];
struct work *p1,p;
struct section *q;
struct payroll *pay;
saveimage(x,y,x+,y+,"e:\\keshe\\temp.bmp");
Loadimage(x,y,"e:\\keshe\\input.bmp");
while(1)
{
getkey(&xk,&yk);
if(yk==13)
{
Loadimage(x,y,"e\\keshe\\temp.bmp");
return 0;
}
else if(yk==27)
switch(state)
case 0: Loadimage(x,y,"e:\\keshe\\temp.bmp");
inputsection(x,y,phead);
break ;
case 1:Loadimage(x,y,"e")
if((p=(struct work *)malloc(sizeof(struct work)))==NULL)
{
diaologe(x,y,"内存不够");
break;
}
while(1)
{
if(iputwork(x,y,p)==1)
{
if(addwork(phead,p,p->section)==0)
if(diaologe2(x,y,"继续吗","继续","取消")==0)
continue ;
else
break ;
}
}
break ;
case 2:diaologe(x,y,"请输入职工名称",workname);
if((p1=findwork(phead,workname))==0)
if(diaologe(x,y,"无法找到","继续","取消")==0)
continue;
else
break:
if((pay=(struct payroll *)malloc(sizeof(struct payroll)))==NULL)
{
diaologe(x,y,"内存不够");
break;
}
if(inputsalary(x,y,pay)==1)
(addsalry(p1,pay);
break ;
else if(yk==80) /*up*/
if(state==0)
{
state=2;
unrectangle(0);
rectangle(2);
}
else
{
state--;
unrectangle(state+1);
rectangle(state);
}
else if(yk==72)
if(state==0)
{
state=2
unrectangle(2);
rectangle(0);
}
else
{
state++;
unrectangle(state-1);
rectangle(state);
}
}
}
void inputsection(int x,int y,struct section *phead)
{
char name[15];
while(1)
{
if(diaologe3(x,y,"请输入您要创建的部门名称",name)==1)
if(findsection(phead,name)==1)
if(diaologe(x,y,"部门已存在","继续","取消")==0)
continue;
else
break;
else
addsection(phead,name);
}
}
int iputwork(int x,int y,struct work *p)
{
int kx,ky;
int state=0;
struct work *p;
saveimage(x,y,x+,y+,"e:\\keshe\\temp.bmp");
Loadimage(x,y,"e:\\keshe\\inputwork.bmp");
while(1)
{
getkey(&kx,&ky);
if(kx==13) /*enter*/
{
switch(state)
case 0:getstring(x,y,p->cardmun);
break:
case 1:getstring(x,y,p->idtification);
break;
case 2:getstring(x,y,p->name);
break;
case 3:getint(x,y,p->sex);
break;
case 4:getint(x,y,p->age);
break;
case 5:getint(x,y,p->workyear);
break;
case 6:getstring(x,y,p->zhicheng);
break;
case 8:getstring(x,y,p->bianhao);
break;
case 9:getstring(x,y,p->section);
break;
case 10:getstring(x,y,p->homephone);
break;
case 11:getstring(x,y,p->mobiephone);
break;
case 12:getint(x,y,p->month);
break;
case 13:butt_down(13);
p->payroll=NULL;
Loadimage(x,y,"e:\\keshe\\temp.bmp");
return 1;
case 14:butt_down(14);
Loadimage(x,y,"e:\\keshe\\temp.bmp");
return 0;
}
else if(kx==27)
{
Loadimage(x,y,"e:\\keshe\\temp.bmp");
return 0;
}
else if(ky==80) /*down*/
{
if(state>12)
{
state=state+1;
bar(state);
unbar(state-1);
}
else if(state==12)
{
state=13;
unbar(12);
butt_on(13);
}
}
else if(ky==72) /*up*/
{
if(state==13)
{
state=12;
bar(12);
butt_off(13);
}
else if(state==14)
{
state=12;
bar(12);
butt_off(13);
}
else if(0<state&&state<13)
{
state--;
bar(state);
unbar(--state);
}
}
else if(ky==75||ky==77) /*left*/
{
if(state==13)
{
butt_on(14);
butt_off(13);
state=14;
}
else if(state==14)
{
butt_on(13);
butt_off(14);
state=13;
}
}
}
}
int inputsalary(int x,int y, struct work *p)
{
int kx,ky;
int state=0;
saveimage(x,y,x+,y+,"e:\\keshe\\temp.bmp");
Loadimage(x,y,"e:\\keshe\\inputsalary.bmp");
while(1)
{
getkey(&kx,&ky);
if(kx==13) /*enter*/
{
switch(state)
case 0:getint(x,y,&(p->month));
break:
case 1:getfloat(x,y,&(p->taxs));
break;
case 2:gefloat(x,y,&((p->a).basesalary));
break;
case 3:getfloat(x,y,&((p->a).salary));
break;
case 4:getfloat(x,y,&((p->a).grant));
break;
case 5:getfloat(x,y,&((p->a).award));
break;
case 6:getfloat(x,y,&((p->b.)Water));
break;
case 7:getfloat(x,y,&((p->b).Electricity));
break;
case 8:butt_down(8); /*queding*/
(p->a).pay=(p->a).basesalary+(p->a).salary+(p->a).grant+(p->a).award;
(p->b).Clealing=5;
(p->b).costs=5;
p->paywage=(p->a).pay-p->taxs-(p->b).Water-(p->b).Electricity-10;
Loadimage(x,y,"e:\\keshe\\temp.bmp");
p->next=NULL;
return 1;
case 9:butt_down(9);
Loadimage(x,y,"e:\\keshe\\temp.bmp");
return 0;
}
else if(kx==27) /*esc*/
{
Loadimage(x,y,"e:\\keshe\\temp.bmp");
return 0;
}
else if(ky==80) /*down*/
{
if(state<7)
{
state=state+1;
bar(state);
unbar(state-1);
}
else if(state==7)
{
state=8;
unbar(7);
butt_on(8);
}
}
else if(ky==72) /*up*/
{
if(state==8)
{
state=7;
bar(7);
butt_off(8);
}
else if(state==9)
{
state=7;
bar(7);
butt_off(9);
}
else if(0<state&&state<8)
{
state--;
bar(state);
unbar(--state);
}
}
else if(ky==75||ky==77) /*left*/
{
if(state==8)
{
butt_on(9);
butt_off(8);
state=9;
}
else if(state==9)
{
butt_on(8);
butt_off(9);
state=8;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -