C++직원 관리 시스템 실현
workermanager.h
#pragma once//
#include <iostream>
#include "worker.h"
using namespace std;
#include "boss.h"
#include "employee.h"
#include "manager.h"
#include <fstream>
#define FILENAME "empFile.txt"
class WorkerManager
{
public:
WorkerManager();
void Show_Menu();//
void ExitSystem();//
int m_EmpNum;//
Worker ** m_EmpArray;//
void Add_Emp();//
void Del_Emp();//
void Find_Emp();//
void Mod_Emp();//
void Show_Emp();//
void Sort_Emp();//
void Clean_File();
int IsExist(int id);// , , -1
void save();//
bool m_FileIsEmpty;// ,
int get_EmpNum();//
void init_Emp();//
~WorkerManager();
};
worker.h
#pragma once//
#include <iostream>
#include <string>
using namespace std;
class Worker//
{
public:
//
virtual void showInfo() = 0;
//
virtual string getDeptName() = 0;
int m_Id;//
string m_Name;//
int m_DeptId;//
};
employee.h
#pragma once
#include <iostream>
using namespace std;
#include "worker.h"
class Employee :public Worker
{
public:
//
Employee(int id, string name, int dId);
//
virtual void showInfo();
//
virtual string getDeptName();
};
manager.h
#pragma once
#include <iostream>
using namespace std;
#include "worker.h"
class Manager :public Worker
{
public:
//
Manager (int id, string name, int dId);
//
virtual void showInfo();
//
virtual string getDeptName();
};
boss.h
#pragma once
#include <iostream>
using namespace std;
#include "worker.h"
class Boss :public Worker
{
public:
Boss(int id, string name, int dId);
virtual void showInfo();
virtual string getDeptName();
};
직원 관리 시스템
#include <iostream>
using namespace std;
#include "WorkerManager.h"
#include "worker.h"
#include "employee.h"
int main()
{
WorkerManager wm;//
int choice = 0;//
while (true)
{
//
wm.Show_Menu();
cout << " :" << endl;
cin >> choice;
switch (choice)
{
case 0://
wm.ExitSystem();
break;
case 1://
wm.Add_Emp();
break;
case 2://
wm.Del_Emp();
break;
case 3://
wm.Find_Emp();
break;
case 4://
wm.Mod_Emp();
break;
case 5://
wm.Show_Emp();
break;
case 6://
wm.Sort_Emp();
break;
case 7://
wm.Clean_File();
system("cls");
break;
}
}
system("pause");
return 0;
}
workermanager.cpp
#pragma once//
#include <iostream>
#include "worker.h"
using namespace std;
#include "boss.h"
#include "employee.h"
#include "manager.h"
#include <fstream>
#define FILENAME "empFile.txt"
class WorkerManager
{
public:
WorkerManager();
void Show_Menu();//
void ExitSystem();//
int m_EmpNum;//
Worker ** m_EmpArray;//
void Add_Emp();//
void Del_Emp();//
void Find_Emp();//
void Mod_Emp();//
void Show_Emp();//
void Sort_Emp();//
void Clean_File();
int IsExist(int id);// , , -1
void save();//
bool m_FileIsEmpty;// ,
int get_EmpNum();//
void init_Emp();//
~WorkerManager();
};
employee.cpp
#include "employee.h"
Employee::Employee(int id, string name, int dId)
{
this->m_Id = id;
this->m_Name = name;
this->m_DeptId = dId;
}
void Employee::showInfo()
{
cout << " :" << this->m_Id
<< "\t :" << this->m_Name
<< "\t :" << getDeptName()
<< "\t : " << endl;
}
string Employee::getDeptName()
{
return string(" ");
}
manager.cpp
#include "manager.h"
Manager::Manager(int id, string name, int dId)
{
this->m_Id = id;
this->m_Name = name;
this->m_DeptId = dId;
}
void Manager::showInfo()
{
cout << " :" << this->m_Id
<< "\t :" << this->m_Name
<< "\t :" << getDeptName()
<< "\t : " << endl;
}
string Manager::getDeptName()
{
return string(" ");
}
boss.cpp
#include "boss.h"
Boss::Boss(int id, string name, int dId)
{
this->m_Id = id;
this->m_Name = name;
this->m_DeptId = dId;
}
void Boss::showInfo()
{
cout << "\t :" << this->m_Id
<< "\t :" << this->m_Name
<< "\t :" << getDeptName()
<< "\t : " << endl;
}
string Boss::getDeptName()
{
return string (" ");
}
이상 이 바로 본 고의 모든 내용 입 니 다.여러분 의 학습 에 도움 이 되 고 저 희 를 많이 응원 해 주 셨 으 면 좋 겠 습 니 다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Visual Studio에서 파일 폴더 구분 (포함 경로 설정)Visual Studio에서 c, cpp, h, hpp 파일을 폴더로 나누고 싶었습니까? 어쩌면 대부분의 사람들이 있다고 생각합니다. 처음에 파일이 만들어지는 장소는 프로젝트 파일 등과 같은 장소에 있기 때문에 파일...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.