1.登录

Administrator_login.h

#pragma once
#include"controller.h"
#include<string>
#include<fstream>
#define FILENAME3 "password.txt"
using namespace std;
class Login
{public:Login();void login();
public:Controller con;
private:string str;
};

Administrator_login1.cpp

#include"Administrator_login.h"
Login::Login()
{ifstream ifs;ifs.open(FILENAME3, ios::in);if (!ifs.is_open()){cout << "未设置密码" << endl;ifs.close();return;}elseifs >> str;ifs.close();
}
void Login:: login()
{string s;cout << "请输入登录密码" << endl;cin >> s;if (s == this->str){this->con.Choice();}else{cout << "密码错误,非管理员禁止登录!" << endl;exit(-1);}
}

2.董事长类

boss.h

#pragma once
#include<iostream>
#include"Work.h"
using namespace std;
class Boss :public Work
{public:Boss(int id, string name, int depid);virtual void  Show_Information();virtual string Get_position_name();
};

boss,cpp

#include"boss.h"
using namespace std;
Boss::Boss(int id, string name, int depid)
{this->n_ID = id;this->n_Name = name;this->n_Dep_number = depid;
}
void Boss::Show_Information()
{cout << "职工编号:" << this->n_ID << endl;cout << "职工姓名:" << this->n_Name << endl;cout << "职工部门:" << this->n_Dep_number << endl;cout << "职工职责:管理经理" << endl;
}
string Boss::Get_position_name()
{return string("懂事长");
}

3.应聘者类

Candidate.h

#pragma once
#include<iostream>
#include"user.h"
class Candidate :public User
{public:Candidate(int id, string name, int depid);void Show_Information();string Get_Motivation();
};

Candidate.cpp

#include"Candidate.h"
Candidate::Candidate(int id, string name, int depid)
{this->id = id;this->n_Name = name;this->depid = depid;
}
void Candidate::Show_Information()
{cout << "访客id为:" << this->id << endl;cout << "访客姓名为:" << this->n_Name << endl;cout << "访客类型为:" << this->depid << endl;
}
string Candidate::Get_Motivation()
{string s("前来公司应聘");return s;
}

4.控制

controller.h

#pragma once
#include<iostream>
#include"Menu.h"
#include"Manager_User.h"
#include"Manager_Work.h"
#include"head_view.h"
class Controller
{public://系统选择void Choice();//展示用户菜单void Show_Menu_user();//展示职员菜单void Show_Menu_work();//查看信息void view();//进入职员系统void Choice_work();//进入用户系统void Choice_User();
public:Menu menu;Manager_User user;Manager_Work work;
};

constroller.cpp

#include"controller.h"
void Controller::Choice()
{cout << "请输入对应数字选择管理系统" << endl;cout << "1 职员管理" << endl;cout << "2 用户管理" << endl;int select = 0;cin >> select;try{if (select == 2){Show_Menu_user();Choice_User();}else if (select == 1){Show_Menu_work();Choice_work();}if (select != 1 && select != 2){throw(-1);}}catch (int a){cout << "输入错误" << endl;cout << "请重新输入" << endl;while (1){cin >> select;if (select == 2){Show_Menu_user();Choice_User();break;}else if (select == 1){Show_Menu_work();Choice_work();break;}cout << "输入错误" << endl;cout << "请重新输入" << endl;}//return;}
}
void Controller::Choice_User()
{//选择编号int n;cout << "请输入你的选择" << endl;cin >> n;//提供分支选择,提供每个功能接口while (1){if (n == 0){user.Exit_the_system();//退出管理系统break;}switch (n){//增加用户信息case 1:user.Add_Person();break;//显示case 2:user.Show_inf();break;//查找case 3:user.Find_user();break;default:system("cls");break;}Show_Menu_user();cout << "请输入你的选择" << endl;cin >> n;}}
void Controller::Choice_work()
{//选择编号int n;cout << "请输入你的选择" << endl;cin >> n;//提供分支选择,提供每个功能接口while (1){if (n == 0){work.Exit_the_system();//退出管理系统break;}switch (n){//增加职工信息case 1:work.Add_Person();break;//显示case 2:work.Show_inf();break;//删除case 3:work.Delete_P();break;//修改case 4:work.Revise_Per();break;//查找case 5:work.Find_per();break;//排序case 6:work.Sort_per();break;//清空case 7:work.Clear_File();break;default:system("cls");break;}Show_Menu_work();cout << "请输入你的选择" << endl;cin >> n;}}
void Controller::view()
{Manager_User user;Manager_Work work;Head_view vi(user, work);vi.View_user();vi.View_work();
}
void Controller::Show_Menu_user()
{this->menu.menu_user();
}
void Controller::Show_Menu_work()
{this->menu.menu_work();
}

5.视图

head_view.h

#pragma once
#include<iostream>
#include"Manager_User.h"
#include"Manager_Work.h"
using namespace std;
class Head_view
{public:Head_view(Manager_User user,Manager_Work work){this->n_User = user;this->n_Work = work;}void View_user(){this->n_User.Show_inf();}void View_work(){this->n_Work.Show_inf();}
public:Manager_User n_User;Manager_Work n_Work;
};

6.总经理

Manager.h

#pragma once
#include<iostream>
#include"Work.h"
using namespace std;
class Manager:public Work
{public:Manager(int id, string name, int depid);virtual void  Show_Information();virtual string Get_position_name();
};

Manager.cpp

#include"Manager.h"
using namespace std;Manager::Manager(int id, string name, int depid)
{this->n_ID = id;this->n_Name = name;this->n_Dep_number = depid;
}
void Manager::Show_Information()
{cout << "职工编号:" << this->n_ID << endl;cout << "职工姓名:" << this->n_Name << endl;cout << "职工部门:" << this->n_Dep_number << endl;cout << "职工职责:完成董事长的任务" << endl;
}
string Manager::Get_position_name()
{return string("总经理");
}

7.管理用户

Manager_User.h

#pragma once
#include<iostream>
#include<fstream>
#include"visitor.h"
#include"Candidate.h"
#include"VIP.h"
#include"user.h"
//#include"controller.h"
#define FILENAME2 "user.txt"
using namespace std;
class Manager_User
{public:Manager_User();//保存文件void Save();void Show_inf();//获取用户数量int get_usernumber();//初始化用户void init_user();//增加用户void Add_Person();//退出系统void Exit_the_system();//查找用户void Find_user();//判断用户是否存在int IsExist(int id);public://用户人数int user_num;//标志文件是否为空bool n_FileIsEmpty;//用户数组指针User** array;
};

Manager_User.cpp


#include"Manager_User.h"
#include<iostream>
Manager_User::Manager_User()
{ifstream ifs;ifs.open(FILENAME2, ios::in);//1.文件不存在情况if (!ifs.is_open()){cout << "文件不存在" << endl;//初始化属性this->user_num = 0;this->array = NULL;this->n_FileIsEmpty = true;ifs.close();return;}//2.文件存在,但是数据为空char ch;//读一个字符ifs >> ch;//如果读完了,文件为空if (ifs.eof()){cout << "文件为空!" << endl;//初始化属性this->user_num = 0;this->array = NULL;this->n_FileIsEmpty = true;//关闭文件ifs.close();return;}//3.文件存在,数据也存在int num = this->get_usernumber();//更新用户数量this->user_num = num;//根据用户数量创建数组this->array = new User * [this->user_num];//开辟空间//初始化用户//将文件中的数据存到数组中init_user();
}
void Manager_User::Show_inf()
{//先判断文件是否为空if (this->n_FileIsEmpty){cout << "文件不存在或者文件为空" << endl;}//不为空时//用多态调用程序接口else{for (int i = 0; i < user_num; i++){cout << "用户类型为:" << this->array[i]->Get_Motivation() << endl;this->array[i]->Show_Information();cout << endl;}//按任意键后清屏system("pause");system("cls");}
}
int Manager_User::get_usernumber()
{ifstream ifs;//以读文件方式打开文件ifs.open(FILENAME2, ios::in);int id;int depid;string name;int num = 0;//记录人数while (ifs >> id && ifs >> name && ifs >> depid){//每读取一行人数+1num++;}ifs.close();return num;
}
void Manager_User::Save()
{ofstream ofs;//写入文件ofs.open(FILENAME2, ios::out);//将每个人的数据写到文件中for (int i = 0; i < this->user_num; i++){ofs << this->array[i]->id << " "<< this->array[i]->n_Name << " "<< this->array[i]->depid << endl;}ofs.close();
}
void Manager_User::init_user()
{ifstream ifs;//以读文件方式打开ifs.open(FILENAME2, ios::in);string name;int id;int depid;int index = 0;while (ifs >> id && ifs >> name && ifs >> depid){User* p = NULL;//根据不同的部门id创建不同的对象if (depid == 1)p = new Visitor(id, name, depid);else if (depid == 2)p = new Candidate(id, name, depid);else{p = new Vip(id, name, depid);}//存放在数组中this->array[index] = p;index++;}ifs.close();
}
void Manager_User::Add_Person()
{cout << "请输入添加用户的数量" << endl;//记录添加用户数量int add_num = 0;cin >> add_num;if (add_num > 0){//新空间的大小=原来人数+新增人数int newSize = this->user_num + add_num;//开辟新空间User** newSpace = new User * [newSize];if (this->array){for (int i = 0; i < this->user_num; i++){newSpace[i] = this->array[i];}}//批量添加数据for (int i = 0; i < add_num; i++){//用户编号int id;//用户姓名string name;//用户类型int dSelect;cout << "请输入第" << i + 1 << "个用户id" << endl;cin >> id;cout << "请输入第" << i + 1 << "个用户姓名:" << endl;cin >> name;cout << "请输入第" << i + 1 << "个用户类型:" << endl;cout << "请选择用户类型:" << endl;cout << "3-VIP" << endl;cout << "2-应聘者" << endl;cout << "1-访客" << endl;cin >> dSelect;User* p = NULL;switch (dSelect){case 1:p = new Visitor(id, name, 1);break;case 2:p = new Candidate(id, name, 2);break;case 3:p = new Vip(id, name, 3);break;}newSpace[this->user_num + i] = p;}//先释放原有空间delete[] this->array;//更改新空间的指向this->array = newSpace;//更新用户人数this->user_num = newSize;cout << "已成功添加" << add_num << "名用户" << endl;//保存数据到文件中this->Save();}else{cout << "输入有误" << endl;}//按任意键后清屏回到上级目录system("pause");system("cls");
}
void Manager_User::Exit_the_system()
{cout << "感谢使用" << endl;system("pause");exit(0);
}
void Manager_User::Find_user()
{if (this->n_FileIsEmpty){cout << "文件不存在或文件为空!" << endl;}else{cout << "请输入查找的方式:" << endl;cout << "1 按用户编号查找" << endl;cout << "2 按用户姓名查找" << endl;int select = 0;cin >> select;if (select == 1){//按照编号查int id;cout << "请输入查找的用户编号:" << endl;cin >> id;//先判断该职工是否存在int ret = IsExist(id);if (ret != -1){//找到职工cout << "查找成功!该职工信息如下:" << endl;this->array[ret]->Show_Information();}else{cout << "查无此人!" << endl;}}else if (select == 2){//按照姓名查string name;cout << "请输入查找的姓名:" << endl;cin >> name;//加入判断是否查到的标志bool flag = false;//默认未找到用户for (int i = 0; i < user_num; i++){if (this->array[i]->n_Name == name){cout << "查找成功!用户编号为" << this->array[i]->id << "号用户信息如下:" << endl;flag = true;this->array[i]->Show_Information();//调用显示信息的函数}}if (flag == false){cout << "查无此人!" << endl;}}else{cout << "输入的选项有误!" << endl;}}//按任意键清屏system("pause");system("cls");
}
int Manager_User::IsExist(int id)
{//一开始认定不在int index = -1;for (int i = 0; i < this->user_num; i++){if (this->array[i]->id == id){index = i;break;//找到即可退出}}return index;
}

8.管理职员

Manager_Work.h

#pragma once
#include<iostream>
#include"Manager.h"
#include"personnel.h"
#include"Work.h"
#include"boss.h"
#include"project_manager.h"
#include"sales_manager.h"
//#include"controller.h"
#include<fstream>
#define FILENAME "empFile.txt"
using namespace std;
class Manager_Work
{public://初始化Manager_Work();//退出系统void Exit_the_system();//添加职工void Add_Person();//保存文件void Save();//统计人数int get_pernumber();//初始化员工void init_personnel();//显示职工void Show_inf();//删除职工void Delete_P();//按照职工编号判断职工是否存在int IsExist(int id);//修改职工void Revise_Per();//查找职工void Find_per();//排序void Sort_per();//清空文件void Clear_File();//清理~Manager_Work();
public://职工人数int n_pernumber;//职工数组指针Work** array;//标志文件是否为空bool n_FileIsEmpty;//如果文件为空,就不进行显示,修改,删除等操作
};

Manager_Work.cpp

#include"Manager_Work.h"
#include<iostream>
using namespace std;
Manager_Work::Manager_Work()
{//分类讨论:ifstream ifs;ifs.open(FILENAME, ios::in);//1.文件不存在if (!ifs.is_open()){cout << "文件不存在" << endl;//初始化属性this->n_pernumber = 0;this->array = NULL;this->n_FileIsEmpty = true;ifs.close();return;}//2.文件存在数据为空char ch;//走读一个字符ifs >> ch;//如果读完了,文件为空if (ifs.eof()){cout << "文件为空!" << endl;//初始化属性this->n_pernumber = 0;this->array = NULL;this->n_FileIsEmpty = true;//关闭文件ifs.close();return;}//3.文件存在,数据存在int num = this->get_pernumber();//更新成员属性this->n_pernumber = num;//根据职工数创建数组this->array = new Work * [this->n_pernumber];//堆区开辟空间//初始化职工//将文件中的数据存到数组中init_personnel();
}void Manager_Work::Revise_Per()
{if (this->n_FileIsEmpty){cout << "文件不存在或者文件为空" << endl;}else{cout << "请输入修改职工的编号" << endl;int id;cin >> id;//判断职工是否存在int n = this->IsExist(id);if (n != -1){//查找到职工编号//删除掉该位置的数据delete this->array[n];//每个数据都重新修改一下//初始状态int new_id = 0;string new_name = " ";int dSelect = 0;cout << "查找到" << id << "职工,请输入新的职工编号" << endl;cin >> new_id;cout << "请输入姓名:" << endl;cin >> new_name;cout << "请输入岗位" << endl;cout << "5-项目经理" << endl;cout << "4-销售经理" << endl;cout << "3-老板" << endl;cout << "2-总经理" << endl;cout << "1-员工" << endl;cin >> dSelect;//重新申请空间Work* p = NULL;switch (dSelect){case 1:p = new Personnel(new_id, new_name, dSelect);break;case 2:p = new Manager(new_id, new_name, dSelect);break;case 3:p = new Boss(new_id, new_name, dSelect);case 4:p = new Sales_manager(new_id, new_name, dSelect);case 5:p = new Porject_Manager(new_id, new_name, dSelect);break;}//更改数据到数组中this->array[n] = p;cout << "修改成功" << this->array[n]->n_Dep_number << endl;//保存到文件中this->Save();}else{cout << "职工不存在,修改失败" << endl;}}// 按任意键清屏system("pause");system("cls");
}
//查找职工信息
void Manager_Work::Find_per()
{if (this->n_FileIsEmpty){cout << "文件不存在或文件为空!" << endl;}else{cout << "请输入查找的方式:" << endl;cout << "1 按职工编号查找" << endl;cout << "2 按职工姓名查找" << endl;int select = 0;cin >> select;if (select == 1){//按照编号查int id;cout << "请输入查找的职工编号:" << endl;cin >> id;//先判断该职工是否存在int ret = IsExist(id);if (ret != -1){//找到职工cout << "查找成功!该职工信息如下:" << endl;this->array[ret]->Show_Information();}else{cout << "查无此人!" << endl;}}else if (select == 2){//按照姓名查string name;cout << "请输入查找的姓名:" << endl;cin >> name;//加入判断是否查到的标志bool flag = false;//默认未找到职工for (int i = 0; i < n_pernumber; i++){if (this->array[i]->n_Name == name){cout << "查找成功!职工编号为" << this->array[i]->n_ID << "号职工信息如下:" << endl;flag = true;this->array[i]->Show_Information();//调用显示信息的函数}}if (flag == false){cout << "查无此人!" << endl;}}else{cout << "输入的选项有误!" << endl;}}//按任意键清屏system("pause");system("cls");
}
void Manager_Work::Clear_File()
{cout << "请确认是否清空" << endl;cout << "输入1 确认" << endl;cout << "输入0 返回" << endl;int select = 0;cin >> select;if (select == 1){//删除文件后重新创建ofstream ofs(FILENAME, ios::trunc);ofs.close();if (this->array){//逐个删除for (int i = 0; i < this->n_pernumber; i++){delete this->array[i];//置空this->array[i] = NULL;}//删除堆区数组指针delete[]this->array;this->array = NULL;//职工人数置零this->n_pernumber = 0;//文件为空的标志置为truethis->n_FileIsEmpty = true;cout << "清空成功!" << endl;}}
}
void Manager_Work::Show_inf()
{//先判断文件是否为空if (this->n_FileIsEmpty){cout << "文件不存在或者文件为空" << endl;}//不为空时//用多态调用程序接口else{for (int i = 0; i < n_pernumber; i++){cout << "职称为:" << this->array[i]->Get_position_name() << endl;this->array[i]->Show_Information();cout << endl;}//按任意键后清屏system("pause");system("cls");}
}
int Manager_Work::IsExist(int id)
{//一开始认定不在int index = -1;for (int i = 0; i < this->n_pernumber; i++){if (this->array[i]->n_ID == id){index = i;break;//找到即可退出}}return index;
}
void Manager_Work::Delete_P()
{if (this->n_FileIsEmpty){cout << "文件不存在或者文件为空" << endl;}else{//按照职工编号删除cout << "请输入想删除的职工编号" << endl;int id = 0;cin >> id;//判断职工是否存在int index = this->IsExist(id);if (index  != -1)//如果职工存在{//该位置后的所有数据前移for (int i = index; i < this->n_pernumber; i++){this->array[i] = this->array[i + 1];}this->n_pernumber--;//数据同步更新到文件中this->Save();cout << "删除成功" << endl;}else{cout << "该职工不存才,删除失败" << endl;}}//按任意键清屏system("pause");system("cls");
}
void Manager_Work::Sort_per()
{if (this->n_FileIsEmpty){cout << "文件不存在或为空" << endl;//按任意键清屏system("pause");system("cls");}else{cout << "请选择职工排序方式" << endl;cout << "输入0 按职工编号升序排序" << endl;cout << "输入1 按职工编号降序排序" << endl;int select = 0;cin >> select;for (int i = 0; i < this->n_pernumber; i++){int max_or_min = i;//声明最大值或最小值下标if (select == 1)//降序{for (int j = i + 1; j < this->n_pernumber; j++){if (this->array[j]->n_ID > this->array[max_or_min]->n_ID){max_or_min = j;}}}else//升序{for (int j = i + 1; j < this->n_pernumber; j++){if (this->array[j]->n_ID < this->array[max_or_min]->n_ID){max_or_min = j;}}}if (i != max_or_min){Work* t = this->array[i];this->array[i] = this->array[max_or_min];this->array[max_or_min] = t;}}cout << "排序后的结果为:" << endl;this->Save();this->Show_inf();}}
void Manager_Work::init_personnel()
{ifstream ifs;//以读文件方式打开ifs.open(FILENAME, ios::in);int id;string name;int depid;int index = 0;//数组下标while (ifs >> id && ifs >> name && ifs >> depid){Work* p = NULL;//根据不同的部门id创建不同的对象if (depid == 1)p = new Personnel(id, name, depid);else if (depid == 2)p = new Manager(id, name, depid);else if (depid == 3)p = new Boss(id, name, depid);else if (depid == 4)p = new Sales_manager(id, name, depid);elsep = new Porject_Manager(id, name, depid);//存放在数组中this->array[index] = p;index++;}ifs.close();
}
//清理操作
Manager_Work::~Manager_Work()
{//释放空间if (this->array){delete[]this->array;this->array = NULL;}
}
int Manager_Work::get_pernumber()
{ifstream ifs;//以读文件方式打开文件ifs.open(FILENAME, ios::in);int id;string name;int depid;int num = 0;while (ifs >> id && ifs >> name && ifs >> depid){num++;//人数++}ifs.close();return num;
}
void Manager_Work::Exit_the_system()
{cout << "感谢使用" << endl;system("pause");exit(0);
}
void Manager_Work::Save()
{ofstream ofs;//用输出的方式打开文件,写文件ofs.open(FILENAME, ios::out);//将每个人的数据写到文件中for (int i = 0; i < this->n_pernumber; i++){ofs << this->array[i]->n_ID << " "<< this->array[i]->n_Name << " "<< this->array[i]->n_Dep_number << endl;}ofs.close();
}
void Manager_Work::Add_Person()
{cout << "请输入添加职工的数量" << endl;//记录添加职工数量int add_num = 0;cin >> add_num;if (add_num > 0){//新空间的大小=原来人数+新增人数int newSize = this->n_pernumber + add_num;//开辟新空间Work** newSpace = new Work * [newSize];if (this->array){for (int i = 0; i <this->n_pernumber; i++){newSpace[i] = this->array[i];}}//批量添加数据for (int i = 0; i < add_num; i++){//职工编号int id;//职工姓名string name;//部门选择int dSelect;cout << "请输入第" << i + 1 << "个职工编号:" << endl;cin >> id;cout << "请输入第" << i + 1 << "个职工姓名:" << endl;cin >> name;cout << "请选择职工岗位:" << endl;cout << "5-项目经理" << endl;cout << "4-销售经理" << endl;cout << "3-老板" << endl;cout << "2-经理" << endl;cout << "1-员工" << endl;cin >> dSelect;Work* p = NULL;switch (dSelect){case 1:p = new Personnel(id, name, 1);break;case 2:p = new Manager(id, name, 2);break;case 3:p = new Boss(id, name, 3);break;case 4:p= new Sales_manager(id, name, 4);break;case 5:p = new Porject_Manager(id, name, 5);}newSpace[this->n_pernumber + i] = p;}//先释放原有空间delete[] this->array;//更改新空间的指向this->array = newSpace;//更新职工人数this->n_pernumber = newSize;cout << "已成功添加" << add_num << "名职工" << endl;//保存数据到文件中this->Save();}else{cout << "输入有误" << endl;}//按任意键后清屏回到上级目录system("pause");system("cls");
}

9.菜单

Menu.h

#pragma once
#include<iostream>
#include"Menu_user.h"
#include"Menu_work.h"
using namespace std;
class Menu
{public:void menu_user(){this->m_user.menu_user();}void menu_work(){this->m_work.menu_work();}
public:M_user m_user;M_work m_work;
};

10.用户菜单

Menu_user.h

#pragma once
#include<iostream>
using namespace std;
class M_user
{public:void menu_user(){cout << "欢迎使用用户管理系统" << endl;cout << "0 退出管理系统" << endl;cout << "1 增加用户信息" << endl;cout << "2 显示用户信息" << endl;cout << "3 查找用户信息" << endl;}
};

11.职员 菜单

Menu_work.h

#pragma once
#include<iostream>
using namespace std;
class M_work
{public:void menu_work(){cout << "欢迎使用职工管理系统" << endl;cout << "0 退出管理系统" << endl;cout << "1 增加职工信息" << endl;cout << "2 显示职工信息" << endl;cout << "3 删除离职职工" << endl;cout << "4 修改职工信息" << endl;cout << "5 查找职工信息" << endl;cout << "6 排序职工信息" << endl;cout << "7 清空所有数据" << endl;}
};

12.普通职工

personnel.h

#pragma once
#include<iostream>
#include<string>
#include"Work.h"
class Personnel :public Work
{public:Personnel(int id, string name, int depid);virtual void Show_Information();virtual string Get_position_name();};

personnel.cpp

#include"personnel.h"
using namespace std;
Personnel::Personnel(int id, string name, int depid)
{this->n_ID = id;this->n_Name = name;this->n_Dep_number = depid;
}
void Personnel::Show_Information()
{cout << "职工编号:" << this->n_ID << endl;cout << "职工姓名:" << this->n_Name << endl;cout << "职工部门:" << this->n_Dep_number << endl;cout << "职工职责:完成经理下达的任务"<< endl;
}
string Personnel::Get_position_name()
{return string("初级员工");
}

13.项目经理

project_manager.h

#pragma once
#include<iostream>
#include"Work.h"
using namespace std;class Porject_Manager :public Work
{public:Porject_Manager(int id, string name, int depid);virtual void Show_Information();virtual string Get_position_name();
};
project_manager.cpp```cpp
#include"project_manager.h"Porject_Manager::Porject_Manager(int id, string name, int depid)
{this->n_ID = id;this->n_Name = name;this->n_Dep_number = depid;
}
void Porject_Manager::Show_Information()
{cout << "职工编号:" << this->n_ID << endl;cout << "职工姓名:" << this->n_Name << endl;cout << "职工部门:" << this->n_Dep_number << endl;cout << "职工职责:管理项目" << endl;
}
string Porject_Manager::Get_position_name()
{return string("项目经理");
}

14.销售经理

sales_manager.h

#pragma once
#include<iostream>
#include"Work.h"
using namespace std;
class Sales_manager :public Work
{public:Sales_manager(int id, string name, int depid);void Show_Information();string Get_position_name();};

sales_manager.cpp

#include"sales_manager.h"Sales_manager::Sales_manager(int id, string name, int depid)
{this->n_ID = id;this->n_Name = name;this->n_Dep_number = depid;
}
void Sales_manager::Show_Information()
{cout << "职工编号:" << this->n_ID << endl;cout << "职工姓名:" << this->n_Name << endl;cout << "职工部门:" << this->n_Dep_number << endl;cout << "职工职责:管理销售" << endl;
}
string Sales_manager::Get_position_name()
{return string("销售经理");
}

15.用户

user.h

#pragma once
#include<iostream>
#include<string>
using namespace std;
class User
{public:virtual void Show_Information() = 0;//純虚virtual string Get_Motivation() = 0;int id;string n_Name;int depid;
};

16.VIP

VIP.h

#pragma once
#include<iostream>
#include"user.h"
class Vip :public User
{public:Vip(int id, string name, int depid);void Show_Information();string Get_Motivation();
};

VIP.cpp

#include"VIP.h"
Vip::Vip(int id, string name, int depid)
{this->id = id;this->n_Name = name;this->depid = depid;
}
void Vip::Show_Information()
{cout << "访客id为:" << this->id << endl;cout << "访客姓名为:" << this->n_Name << endl;cout << "访客类型为:" << this->depid << endl;
}
string Vip::Get_Motivation()
{string s("享受公司所有服务");return s;
}

17.访客

visitor.h

#pragma once
#include<iostream>
#include"user.h"
class Visitor :public User
{public:Visitor(int id,string name,int depid);void Show_Information();string Get_Motivation();
};

visitor.cpp

#include"visitor.h"
Visitor::Visitor(int id,string name,int depid)
{this->id = id;this->n_Name = name;this->depid = depid;
}
void Visitor::Show_Information()
{cout << "访客id为:" << this->id << endl;cout << "访客姓名为:" << this->n_Name << endl;cout << "访客类型为:" << this->depid << endl;
}
string Visitor::Get_Motivation()
{string s("刷视频看到本公司");return s;
}

18.职员

Work.h

#pragma once
#include<iostream>
#include<string>
using namespace std;
//职工类
class Work
{public:virtual void Show_Information() = 0;//純虚virtual string Get_position_name() = 0;int n_ID;//职工编号string n_Name;//职工姓名int n_Dep_number;//部门编号
};

19.主函数

main.cpp

#pragma once
#include<iostream>
#include"boss.h"
#include"Manager.h"
#include"Manager_Work.h"
#include"personnel.h"
#include"Work.h"
#include"Manager_User.h"
#include"project_manager.h"
#include"sales_manager.h"
#include"visitor.h"
#include"Candidate.h"
#include"VIP.h"
#include"user.h"
#include"head_view.h"
#include"controller.h"
#include"Menu.h"
#include"Administrator_login.h"
//#include<graphics.h>
using namespace std;
int main()
{//登录Login l;l.login();return 0;
}

c++面向对象程序设计大作业(人事管理系统)相关推荐

  1. C++面向对象程序设计大作业:魔兽世界(三):开战

    C++面向对象程序设计大作业:魔兽世界(三):开战 问题描述 问题分析 代码 问题描述 问题来自于北京大学郭炜老师的C++慕课的大作业 魔兽世界的西面是红魔军的司令部,东面是蓝魔军的司令部.两个司令部 ...

  2. C++大作业(面向对象程序设计大作业)——销售公司员工管理

    面向对象程序设计大作业 目录 面向对象程序设计大作业 1.问题重述 2.编程思想 2.1数据结构 2.2功能确定 3.类的设计 3.1UML图标准 3.2本题类图 4.运行结果 1.输出所有信息 2. ...

  3. C#大作业——人事管理系统

    此文仅为记录在校期间windows应用开发课程学习成果,本项目仍存在很多不足,仅供参考学习使用. 本门课程大作业要求完成一个具有主界面.用户登录.注册.注销.重新登陆.员工信息增删改查等功能的系统.其 ...

  4. 东北大学软件学院C语言程序设计大作业:餐厅管理系统

    东北大学软件学院C语言程序设计大作业 餐厅管理系统 这一份是自己做的,里面应该有超级多的bug来着,等我闲了改一下 //100张桌子 //1-4人 1-50号桌 //5-8人 51-70号 //9-1 ...

  5. 程序设计大作业:教务管理系统(C语言)

    写在前头: 这个大作业是大一写的,所以比较低能,全篇只涉及C语言相关知识,且有些内容我自己看了都嫌弃.嘿嘿. 我整理了资源,可以免费下载:程序设计大作业:教务管理系统(C语言)-C文档类资源-CSDN ...

  6. c语言程序设计创新大作业,C语言程序设计大作业报告.pdf

    C语言程序设计大作业报告 课程设计(大作业)报告 课程名称: C 语言程序设计 设计题目: 实验设备管理系统 院 系: 信息技术学院 班 级: 2015级物联网工程 1班 设 计 者: 何盛 高陶 王 ...

  7. 2017《面向对象程序设计》作业四

    2017<面向对象程序设计>作业四 林燊 031602325 https://www.cnblogs.com/linshen/ github链接:https://github.com/Tr ...

  8. Python程序设计 大作业 简化的PS

    查看原文 Python程序设计 作业 海龟绘图 文本处理 分组游戏设计 数字照片墙 送你一首集句诗 简化的PS Python程序设计 大作业 简化的PS Python程序设计 作业 摘要 1. 项目背 ...

  9. C语言大作业:车辆管理系统

    C语言大作业:车辆管理系统 声明 此代码使用VS2019编译器进行编译 使用 vc 和 dev-c 的有可能会出现编译警告,需要自己去网上查找相关的编译环境的问题 其次使用vs编译器也可能会报 C49 ...

最新文章

  1. python多久学会自学-零基础自学Python多久可以找工作?
  2. 【错误记录】Android Studio Logcat 报错 ( read: unexpected EOF! )
  3. PMCAFF产品经理第一课 | 深圳站 现场集锦
  4. python 最小二乘回归 高斯核_最经典的回归模型参数估计算法—最小二乘
  5. *p++和*(p++)的区别_同是华为顶级旗舰,P系和Mate系谁最值得购买?明白这点很重要!...
  6. 如何保证Session值不丢失
  7. 14、 Integer 与 int 的区别
  8. 关于sqlite多线程
  9. 读书笔记 ---《偷影子的人》
  10. 今天母亲节,作为程序员,我是这样表达爱的……
  11. 简单理解网络分层模型--向计算机网络迈一小jio;还会有后续;
  12. 【回溯】有蹩脚的马踏棋盘——思路巨清晰!!!
  13. React、umi和dva之间的关系
  14. 阿里云服务(四)—云数据库RDS
  15. 浅谈电话机器人与人工坐席的优劣势
  16. 在linux后台运行脚本的方法和命令
  17. 揪出Android流氓软件
  18. 《碟中谍5》背后的生物识别技术大比拼
  19. 【Python】图片处理
  20. 2.5亿企业微信用户福利到啦!快递管家企业版,让快递收发管理更简单

热门文章

  1. 新手提问 请给为大哥指点迷津
  2. 【Autodesk Maya】ptyhon 常用命令
  3. Linux—DNS域名解析服务
  4. 6代之后的CPU安装win7的方法
  5. E-捡贝壳 2021年广东工业大学第十五届文远知行杯程序设计竞赛(同步赛)
  6. 投行品质办公软件Word制作(第一讲)——第五届CVA估值建模精英计划
  7. 新西兰发明新型传感器,电子产品不再需要充电器
  8. JavaScript归纳
  9. 非关系型数据库MongoDB学习笔记
  10. 《云原生入门级开发者认证》学习笔记之云原生基础设施之容器技术