教室工资管理系统c语言课程设计csdn,工资管理系统(C编写)

080401231402.jpg#include#include#include//包含清屏、退出程序函数。

#include//备份数据

#include

class Employee

{

public:

friend class worker;

void shanchu() {*name=*sex=0;number=age=0;}

Employee() {next=0;}

virtual void print()=0;

void input()

{

cout>number>>name>>sex>>age;  /*说明此处没用setw()函数,只用空格符号分开来。所以------*/

}

protected:                  //不能使用私有成员

int number,age;

char name[20],sex[10];

Employee *next;

};

class technician:virtual public Employee

{

public:

technician() {}

virtual void shanchu() {*name=*sex=0;number=age=hour=0;pay1=0;}

void wage() { pay1=100*hour;}

virtual void print()

{

wage();

cout

void input()

{

Employee::input();

cout>hour;

}

protected:

int hour,pay1;

};

class manager:virtual public Employee

{

public:

friend class SM;

manager() {}

virtual void shanchu() {*name=*sex=0;number=age=month=0;pay2=0;}

void  wage() {pay2=800*month;}

virtual void print()

{

wage();

cout

void input()

{

Employee::input();

cout>month;

}

protected:

int month,pay2;

};

class seller:virtual Employee

{

public:

friend class SM;

seller() {}

virtual void shanchu()

{*name=*sex=0;number=age=0;salesvolume=pay3=0;} //salesvolume表示销售额

void wage() {pay3=salesvolume*0.04;}

void input()

{

Employee::input();

cout>salesvolume;

}

virtual void print()

{

pay3=salesvolume*0.04;

cout

protected:

double salesvolume, pay3;

};

class SM:public manager,public seller

{

public:

friend class worker;

SM() {}

virtual void shanchu() {*name=*sex=0;number=age=0;total=pay4=0;}

void wage()

{

pay4=5000+(total)*0.005;

}

void input()

{

Employee::input();

cout>total;

}

virtual void print()

{

wage();

cout

double total,pay4;

};

class worker

{

public:

technician *pa;

seller *pb;

manager *pc;

SM *pd;

Employee *p;

Employee *p1; /* int number,age,hour,month;salemoney;char *name,*sex; 重复定义*/

worker()

{

Employee *p=new technician;p1=p;

}

void add();

void output();      //不能用print() 二义性

void find();

void change();

void del();        //不能使用关键字delete

void save();

};

void worker::add()

{

int a;

Employee *p=p1;

while(p->next)

p=p->next;

cout>a;

switch(a)

{

case 1:

cout

pa->input();

p->next=pa;

break;

case 2:

cout

pb->input();

p->next=pb;

break;

case 3:

cout

pc->input();

p->next=pc;

break;

case 4:

cout

pd->input();

p->next=pd;

break;

default:

cout

}

void worker::output()

{

Employee  *p=p1;

if(!p)

{

cout

}

while(p)

{

p->print();

p=p->next;

}

}

void worker::find()

{

Employee *p=p1;

if(!p)

{

cout

}

cout

cin>>b;

for(p;p=p->next;)

{

if(p->number==b)

{

coutprint();

break;

}

}

if(!p)

{

cout

}

void worker::change()

{

Employee *p=p1;

if(!p)

{

cout

}

cout

cin>>c;

for(p;p=p->next;)

{

if(p->number==c)

{

coutprint();

coutinput();

cout

}

}

if(!p)

{

cout

}

void worker::del()

{

Employee *p=p1;

if(!p)

{

cout

}

cout

cin>>d;

for(p;p=p->next;)

{

if(p->number==d)

{

coutshanchu();

break;

}

}

if(!p)

{

cout

}

void worker::save()

{

char sh;

ifstream f1("F:\\ccx1.cpp");

if(!f1)

{

cout

}

ofstream f2("F:\\ccx.cpp");

if(!f2)

{

cout

}

while(f1.get(sh))

f2.put(sh);

f1.close();

f2.close();

cout

void main()

{

MessageBox(0,"欢迎使用本程序!!"," ",0);   //包含在#include头文件里

cout

cin>>e;

if(e==19871121)

{

cout

int f=1;

while(f)

{

cout

cin>>g;

switch(g)

{

case 1:

w.add();

break;

case 2:

w.output();

break;

case 3:

w.find();

break;

case 4:

w.change();

break;

case 5:

w.del();

break;

case 6:

system("cls");

break;

case 7:

w.save();

break;

case 8:

exit(1);

default:

cout

}

}

else

{

cout

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值