求c++公司职员信息管理系统代码

ydmtttt 2010-07-23 02:15:32
1、 某小型公司,主要由总经理、技术经理和技术人员、销售经理和销售人员。要求存储所有人员的一下信息:姓名、性别、出生年月、技术特长、血型、星座、参加工作时间、接入本公司时间、联系电话、编号、级别、当月薪、计算月薪总额并显示全部信息。
2、 人员的编号从1开始,依次递增。
3、 程序对所有人员有提升级别的功能。假设所有人员的初始级别均为1级,然后进行升级,总经理升为4级,技术经理和销售经理升为3级,技术人员升为2级,销售人员为1级。
4、 月工资计算办法如下:总经理拿固定月薪10000元; 技术经理拿固定月薪6000元加奖金;技术人员拿固定月薪3000元加奖金;销售经理既拿固定月薪也领取销售提成,固定月薪为4000元,销售提成为所辖部门的当月销售总额的5‰;销售人员的月薪按当月销售额的1%提成。
5、 考核结果作为升级和工资提成的依据,考核结果按百分制计算。
二、 基本功能要求
设计一个基类employee,然后派生出technician(技术人员)类、manager(经理)类和saleman(销售人员)类共3类,在此基础上通过继承和派生实现其它类。职员信息要求保存到文件。对部分数据应设置有操作权限。
三、 功能描述
1、 新进入公司员工基本信息的输入。
2、 公司员工基本信息的查询、修改。
3、 离开公司员工信息的处理。
4、 与员工级别有关的操作。
5、 与月薪有关的操作。
6、 与人员考核有关的操作。
四、 主要知识点
1、 C语言程序设计技术,特别是数组和指针的应用。
2、 面向对象程序设计技术,特别是继承和派生以及文件的操作。
...全文
651 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
眼睛猥琐男 2010-07-23
  • 打赏
  • 举报
回复
这里有一套源码可以下载
是一本书里面的
http://download.csdn.net/source/496120
niupanboy 2010-07-23
  • 打赏
  • 举报
回复
又是毕业设计么。。现在到交毕业设计的时候么,?
ayw215 2010-07-23
  • 打赏
  • 举报
回复
学习~~
elegant87 2010-07-23
  • 打赏
  • 举报
回复

#include<iostream>
#include <string.h>
using namespace std;
class day
{
public:
day(int y=0,int m=0,int d=0);
~day();
day(day&one);
void Setday();
void Getday();
private:
int year,month,date;
};

class people
{

public:
people();
people(char*name,int number,char*sex,char*id,day bir);
~ people();
void Setpeople();
void Getpeople();
void operator==(people p1);
void operator=(people p2);
char id[20];int number;

private:
char name[20]; char sex;day birthday;
};
//student类的定义
class student : public people
{ public:
student();
student(char*name,int number,char*sex,char*id,day bir,char*classNO);
void Setstudent1();
void Setstudent2();
void Getstudent1();
void Getstudent2();
~student();
private:
char classNO[7];
};

//teacher类的定义
class teacher: virtual public people
{public:
teacher();
~teacher();
teacher(teacher&a);
void Setteacher1();
void Setteacher2();
void Getteacher1();
void Getteacher2();
private:
char principalship[11];char department[21];
};

//graduate类的定义
class graduate:virtual public student
{
public:
graduate();
~graduate();
void Setgraduate1();
void Setgraduate2();
void Getgraduate1();
void Getgraduate2();
private
:
char subject[21]; teacher teacheradviser;
};
//TA类的定义
class TA: public graduate,public teacher
{
public:
TA();
~TA();
void SetTA();
void GetTA();
private:
int time;float pay;
};

//day类的实现
day::day(int y,int m,int d){ year=y;month=m;date=d;}
day::~day() {}
day::day(day&one)
{ date=one.date;
month=one.month;
year=one.year;
}
void day::Setday(){cout<<"请输入出生日期(年月日之间以空格键或回车键分开):";cin>>year>>month>>date;}
void day::Getday(){cout<<"出生日期为:"<<year<<"年"<<month<<"月"<<date<<"日"<<endl;}

//people类的实现
people::people(){}
people:: people(char*name,int number,char*sex,char*id,day bir){birthday=bir;}
people::~people(){}
void people::Setpeople()
{
cout<<"请输入姓名:";cin>>name;cout<<"请输入编号:";cin>>number;
cout<<"请输入该人的性别(x代表女,y代表男):";cin>>sex;cout<<"请输入身份证号码:";cin>>id;
birthday.Setday();
}
void people::Getpeople()
{
cout<<"该人的姓名为:"<<name<<endl<<"该人的编号为:"<<number<<endl;
cout<<"该人的性别为:";if(sex=='x')cout<<"女"<<endl; else cout<<"男"<<endl;
cout<<"该人的身份证号码为:"<<id<<endl;birthday.Getday();
}
void people::operator==(people p1)
{
if(id==p1.id)cout<<"这两个people类对象的id相同"<<endl;
else cout<<"这两个people类的对象的id不相同"<<endl;
}
void people::operator=(people p2)
{ people p;
strcpy(name,p2.name);number=p2.number;sex=p2.sex;strcpy(id,p2.id);birthday=p2.birthday; }

//student类的实现

student::student(){}

student::~student(){}
void student::Setstudent1(){people::Setpeople();}
void student::Setstudent2(){cout<<"请输入班号:";cin>>classNO;}
void student::Getstudent1(){people::Getpeople();}
void student::Getstudent2(){cout<<"该学生的班号为:"<<classNO<<endl;}

//teacher类的实现

teacher::teacher(){}
teacher::~teacher(){}
teacher::teacher(teacher&a){cout<<"拷贝构造函数被调用";}
void teacher::Setteacher1(){people::Setpeople();}
void teacher::Setteacher2(){cout<<"请输入老师的职务:";cin>>principalship;
cout<<"请输入老师的部门:";cin>>department;}
void teacher::Getteacher1(){people::Getpeople();}
void teacher::Getteacher2(){cout<<"该老师的职务是:" <<principalship<<endl<<"该老师的部门是:"<<department<<endl;}
//graduate类的实现

graduate::graduate(){}
graduate::~graduate(){};
void graduate::Setgraduate1(){student::Setstudent1();student::Setstudent2();}
void graduate::Setgraduate2(){ cout<<"请输入专业:";cin>>subject;cout<<"请输入导师的信息为:"<<endl;
teacheradviser.Setteacher1();teacheradviser.Setteacher2();}
void graduate::Getgraduate1(){student::Getstudent1();student::Getstudent2();}
void graduate::Getgraduate2(){cout<<"该研究生的专业为:"<<subject<<endl;cout<<"导师的信息为:"<<endl;
teacheradviser.Getteacher1();teacheradviser.Getteacher2();}

//TA类的实现

TA::TA(){}
TA::~TA(){}
void TA::SetTA(){student::Setstudent1();student::Setstudent2();graduate::Setgraduate2();
cout<<"请输入该助教生的助教信息:"<<endl;teacher::Setteacher2();
cout<<"请输入助教生的工作时间:";cin>>time;cout<<"请输入助教生的工资:";cin>>pay;}
void TA::GetTA(){student::Getstudent1();student::Getstudent2();graduate::Getgraduate2();
cout<<"该助教生的助教信息为:"<<endl;teacher::Getteacher2();
cout<<"该助教生的工作时间为:"<<time<<endl<<"该助教生的工资为:"<<pay<<endl;}

people p;student t;teacher a;graduate g;TA T;
int peopleNO=0,studentNO=0,teacherNO=0,graduateNO=0,TANO=0;int number;
void Set(int i)
{
switch(i)
{
case 0:{cout<<"请输入people的信息:"<<endl;p.Setpeople();peopleNO++;}break;
case 1:{cout<<"请输入student的信息:"<<endl;t.Setstudent1();t.Setstudent2();studentNO++;}break;
case 2:{cout<<"请输入teacher的信息:"<<endl;a.Setteacher1();a.Setteacher2();teacherNO++;}break;
case 3:{cout<<"请输入graduate的信息:"<<endl;g.Setgraduate1();g.Setgraduate2();graduateNO++;}break;
case 4:{cout<<"请输入TA的信息:"<<endl;T.SetTA();TANO++;}break;
default:cout<<"Error!you must enter 0,1,2,3or4"<<endl;
}

}

void Swap(people&p1,people&p2)//辅助函数交换people类的对象
{
people t;
t=p1;
p1=p2;
p2=t;
}

void SelectionSort(people p[] ,int n)//对people类的对象进行排序
{
int smallIndex;
int i,j;
for(i=0;i<n-1;i++)
{
smallIndex=i;
for(j=i+1;j<n;j++)
if(p[j].number<p[smallIndex].number)
smallIndex=j;
Swap(p[i],p[smallIndex]);

}
cout<<"按编号由小到大排列为:"<<endl;
for(i=0;i<n;i++)
{
p[i].Getpeople();
}
}
void SeqSeach(people p[],int n)
{
int number;char ch;
cout<<"请输入你要查找对象的编号:"<<endl;
cin>>number;
for(int i=0;i<n;i++)
{
if(number==p[i].number)p[i].Getpeople();
}
if(number!=p[i].number) cout<<"there is not the people"<<endl;
cout<<"继续输入吗?是'Y'否'N':"<<endl;
cin>>ch;
if(ch=='Y')
SeqSeach( p, n);
}



int main()
{
cout<<"*********Welcome to you!***********"<<endl;
int i; char ch;int t=1;
line:do
{
cout<<"请选择你要输入的人员信息"<<endl;
cout<<"0-people 1-student 2-teacher 3-graduate 4-TA:";
cin>>i;Set(i);cout<<"你还要输入其他人得信息吗?是“Y”,否“N”:";cin>>ch;
}
while(ch=='Y');
if(ch=='N'){cout<<"输入任务结束,请执行其他任务"<<endl;}
else
{cout<<"Error!you must enter 'Y'or'N'"<<endl<<"请重新输入"<<endl;goto line ;}

cout<<"你要对people类执行操作吗?是'Y',否'N':";//处理people类的对象
cin>>ch;
if(ch=='Y')
{ cout<<"请先输入people类的对象:"<<endl;
cout<<"你能够输入三个people类的对象"<<endl;
int t,i,a,b;people p[3];
for(t=0;t<3;t++)
{
cout<<"请输入people类对象的信息:"<<endl;p[t].Setpeople();
}
do
{
cout<<"请选择你要执行的操作:"<<endl;
cout<<" 1-比较对象的id 2-按编号排序 3-按编号查找 <<endl;
cin>>i;
switch(i)
{
case 1:{cout<<"请输入你要比较的对象:";cin>>a>>b;p[1]==p[2];}break;
case 2: SelectionSort( p,3);break;
case 3: SeqSeach(p,3); break;
}
cout<<"你还要执行其它操作吗?是'Y', 否'N':";cin>>ch;
}while(ch=='Y');
if(ch=='N')cout<<"请执行其它操作"<<endl;
}
else cout<<"请执行其他任务"<<endl;


cout<<"你要显示你输入的人员信息吗?是'Y',否'N':";
cin>>ch;
if(ch=='Y')
{
if(peopleNO!=0)
{
for(t=1;t<=peopleNO;t++)
{cout<<"people的信息为:"<<endl;p.Getpeople();}
}
else{cout<<"there is no people's message"<<endl;}
if(studentNO!=0)
{
for(t=1;t<=studentNO;t++)
{cout<<"student的信息为:"<<endl;}
}
else{cout<<"there is no student's message"<<endl;}
if(teacherNO!=0)
{
for(t=1;t<=teacherNO;t++)
{cout<<"teacher的信息为:"<<endl;a.Getteacher1();a.Getteacher2();}
}
else{cout<<"there is no teacher's message"<<endl;}
if(graduateNO!=0)
{
for(t=1;t<=graduateNO;t++)
{cout<<"graduate的信息为:"<<endl;g.Getgraduate1();g.Getgraduate2();}
}

else{cout<<"there is no graduate's message"<<endl;}
if(TANO!=0)
{
for(t=1;t<=TANO;t++)
{cout<<"TA的信息为:"<<endl;T.GetTA();}
}
else{cout<<"there is no TA's message"<<endl;}
}
else
if(ch=='N'){cout<<"请执行其他操作"<<endl;}
else cout<<"Error!you must enter'Y'or'N'"<<endl;

return 0;
}
zsdl1288 2010-07-23
  • 打赏
  • 举报
回复
//employee.h

class employee
{
protected:
char *name;
int individualEmpNo;
int grade;
double accumPay;
static int employeeNo;
public:
employee();
~employee();
virtual void pay()=0;
virtual void promote(int increment=0);
virtual void displayStatus()=0;
};

class technician:public employee
{
private:
float hourlyRate;
int workHours;
public:
technician();
void promote(int);
void pay();
void displayStatus();
};

class salesman:virtual public employee
{
protected:
double CommRate;
float sales;
public:
salesman();
void promote(int);
void pay();
void displayStatus();
};

class manager:virtual public employee
{
protected:
float monthlyPay;
public:
manager();
void promote(int);
void pay();
void displayStatus();
};

class salesmanager:public manager,public salesman
{
public:
salesmanager();
void promote(int);
void pay();
void displayStatus();
};

//employee.cpp

#include <iostream.h>
#include <string.h>
#include "employee.h"
int employee::employeeNo=1000;

employee::employee()
{
char namestr[50];
cout<<"请输入下一个雇员的姓名:";
cin>>namestr;
name=new char[strlen(namestr)+1];
strcpy(name,namestr);
individualEmpNo=employeeNo++;
grade=1;
accumPay=0.0;
}
employee::~employee()
{
delete name;
}
void employee::promote(int increment)
{
grade+=increment;
}
technician::technician()
{
hourlyRate=100;
}
void technician::promote(int)
{
employee::promote(2);
}
void technician::pay()
{
cout<<endl<<"请输入"<<name<<"本月的工作时间(单位:时):";
cin>>workHours;
accumPay=hourlyRate*workHours;
cout<<"兼职技术人员:"<<name<<endl<<"编号:"
<<individualEmpNo<<endl<<"本月工资:"<<accumPay<<endl;
}
void technician::displayStatus()
{
cout<<"级别:"<<grade
<<endl<<"已付本月工资:"<<accumPay<<endl;
}
salesman::salesman()
{
CommRate=0.04;
}
void salesman::promote(int)
{
employee::promote(0);
}
void salesman::pay()
{
cout<<endl<<"请输人"<<name<<"本月的销售额:";
cin>>sales;
accumPay=sales*CommRate;
cout<<"推销员:"<<name<<endl<<"编号:"<<individualEmpNo
<<endl<<"本月工资:"<<accumPay<<endl;
}
void salesman::displayStatus()
{
cout<<"级别:"<<grade<<endl<<"已付本月工资:"
<<accumPay<<endl;
}
manager::manager()
{
monthlyPay=8000;
}
void manager::promote(int)
{
employee::promote(3);
}
void manager::pay()
{
accumPay=monthlyPay;
cout<<"经理:"<<name<<endl<<"编号:"<<individualEmpNo
<<endl<<"本月工资:"<<accumPay<<endl;
}
void manager::displayStatus()
{
cout<<"级别:"<<grade<<endl<<"已付本月工资:"
<<accumPay<<endl;
}
salesmanager::salesmanager()
{
monthlyPay=5000;
CommRate=0.005;
}
void salesmanager::promote(int)
{
employee::promote(2);
}
void salesmanager::pay()
{
cout<<endl<<"请输入"<<employee::name
<<"所管辖部门本月的销售总额:";
cin>>sales;
accumPay=monthlyPay+CommRate*sales;
cout<<"销售经理:"<<name<<endl<<"编号:"<<individualEmpNo
<<endl<<"本月工资:"<<accumPay<<endl;
}
void salesmanager::displayStatus()
{
cout<<"级别:"<<grade<<endl<<"已付本月工资:"
<<accumPay<<endl;
}

//empfunc.cpp

#include <iostream.h>
#include "employee.h"
void main()
{
cout<<"********小型公司的人员管理系统********"
<<endl;

manager m1;
technician t1;
salesmanager sm1;
salesman s1;
employee *emp[4]={&m1,&t1,&sm1,&s1};

int i;
for(i=0;i<4;i++)
{
emp[i]->promote();
emp[i]->pay();
emp[i]->displayStatus();
}

}
可能功能没有你说的那么全 但是你可以在这上再加
zsdl1288 2010-07-23
  • 打赏
  • 举报
回复
给我邮箱 我发给你 我以前做个这个东西
zhangweiit 2010-07-23
  • 打赏
  • 举报
回复
这里有一套源码可以下载
是一本书里面的
http://download.csdn.net/source/496120

64,281

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧