📄 delete.cpp
字号:
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
#include <graphics.h>
#include <strstrea.h>
#include <iostream.h>
#include <fstream.h>
#include <iomanip.h>
#include "item.h"
#include "employee.h"
#include "labour.h"
#include "manager.h"
#include "commis.h"
#include "piece.h"
#include "hourly.h"
#include "lpiece.h"
extern void MessageBox(char *);
extern void judgeKey(Item *);
extern int jkey(char *,int);
int dFun(Employee *p,char *text)
{
Employee *q;
int x1=130,y1=80,x2=420,y2=200,flag=1;
char fName[10],lName[10];
setcolor(GREEN);
rectangle(x1,y1,x2,y2);
setfillstyle(1,CYAN);
floodfill(x1+2,y1+2,GREEN);
setfillstyle(1,BLACK);
bar(x1+20,y2+1,x2+20,y2+20);
bar(x2+1,y1+20,x2+20,y2);
setcolor(BLUE);
settextjustify(CENTER_TEXT,CENTER_TEXT);
settextstyle(0,0,2);
outtextxy(275,110,text);
settextstyle(0,0,1);
outtextxy(220,146,"First Name:");
outtextxy(220,178,"Last Name:");
setfillstyle(1,BLACK);
bar(280,138,380,162);
gotoxy(37,10);
for(int k=0;k<10;k++) {fName[k]=0;lName[k]=0;}
if(jkey(fName,10)) return 0;
gotoxy(37,12);
setfillstyle(1,BLACK);
bar(280,170,380,194);
if(jkey(lName,10)) return 0;
for(;p;p=p->getNext())
if(strcmp(p->getFirstName(),fName)==0&&strcmp(p->getLastName(),lName)==0)
{
q=p->getNext();
delete p;
p=q;
MessageBox("Delete OK");
flag=0;
break;
}
if(flag) MessageBox("Not found the name!");
return 1;
};
void dmanFun()
{
Manager *pm;
pm=pm->getFirst();
dFun(pm,"MANAGER");
setfillstyle(1,BLUE);
bar(130,80,440,250);
};
void dcomFun()
{
CommissionWorker *pc;
pc=pc->getFirst();
dFun(pc,"COMMISSION WORKER");
setfillstyle(1,BLUE);
bar(130,80,440,250);
};
void dhourFun()
{
HourlyWorker *ph;
ph=ph->getFirst();
dFun(ph,"HOURLY WORKER");
setfillstyle(1,BLUE);
bar(130,80,440,250);
};
void dpieceFun()
{
PieceWorker *pp;
pp=pp->getFirst();
dFun(pp,"PIECE WORKER");
setfillstyle(1,BLUE);
bar(130,80,440,250);
};
void dlabFun()
{
LabourWorker *pl;
pl=pl->getFirst();
dFun(pl,"LABOUR WORKER");
setfillstyle(1,BLUE);
bar(130,80,440,250);
};
void dunitFun()
{
LabourAndPiece *pu;
pu=pu->getFirst();
dFun(pu,"LABOUR AND PIECE");
setfillstyle(1,BLUE);
bar(130,80,440,250);
};
void delFun()
{
int x1=480,y1=200,x2=635,y2=220;
Item dman(x1,y1+20,x2,y2+20,15,14,9,"Manager",dmanFun);
dman.drawItem();
Item dcom(x1,y1+40,x2,y2+40,15,14,9,"Commission Worker",dcomFun);
dcom.drawItem();
Item dhour(x1,y1+60,x2,y2+60,15,14,9,"Hourly Worker",dhourFun);
dhour.drawItem();
Item dpiece(x1,y1+80,x2,y2+80,15,14,9,"Piece Worker",dpieceFun);
dpiece.drawItem();
Item dlab(x1,y1+100,x2,y2+100,15,14,9,"Labour Worker",dlabFun);
dlab.drawItem();
Item dunit(x1,y1+120,x2,y2+120,15,14,9,"Unit:Labour&Piece",dunitFun);
dunit.drawItem();
dman.changeBK(7);
Item *pd;
pd=pd->getFirst();
judgeKey(pd);
setfillstyle(1,BLUE);
bar(480,220,635,380);
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -