⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 employee.cpp

📁 员工签到系统是一个能统计员工每天签到情况的软件
💻 CPP
字号:
#include <iostream>
#include <conio.h>
#include "Employee.h"
using namespace std;

CEmployee::CEmployee()
{
	return ;
}

CEmployee::~CEmployee()
{
	return ;
}

void CEmployee::Init()
{
	system("cls");
	cout << "请输入姓名:";
	cin >> m_stEmp.szName;
	cout << endl << "请输入性别:";
	cin >> m_stEmp.szSex;
	cout << endl << "请输入民族:";
	cin >> m_stEmp.szNation;
	cout<< endl << "请输入出生日期(年 月 日):";
	cin >> m_stEmp.stBorn.nYear >> m_stEmp.stBorn.nMonth >> m_stEmp.stBorn.nDay;
	cout << endl << "请输入学历:";
	cin >> m_stEmp.szSchoolRecord;
	system("cls");
	cout << endl << "请输入籍贯:";
	cin >> m_stEmp.szNativePlace;
	cout << endl << "任职日期(年 月 日):";
	cin >> m_stEmp.stEOD.nYear >> m_stEmp.stEOD.nMonth >> m_stEmp.stEOD.nDay;
	cout << endl << "部门:";
	cin >> m_stEmp.szSection;
	cout << endl << "请输入职务:";
	cin >> m_stEmp.szPost;
	cout << endl << "请输入住址:";
	cin >> m_stEmp.szAddress;
	m_stEmp.emEmploy = Null;
	next = NULL;
}

void CEmployee::SignFun()
{
	system("cls");
	if(m_stEmp.emEmploy == Null)
	{
		m_stEmp.emEmploy = Sign;
		cout << m_stEmp.szName << "签到成功!" << endl;
	}
	else
	{
		cout << "你已经签过了!" << endl;
	}
	cout << endl << endl << "按任意键继续~" ;
	getch();
	return ;
}

void CEmployee::SickFun()
{
	system("cls");
	if(m_stEmp.emEmploy == Null)
	{
		m_stEmp.emEmploy = Sick;
		cout << m_stEmp.szName << "请病假被批准!" << endl;
	}
	else
	{
		cout << "你已经签过了!" << endl;
	}
	cout << endl << endl << "按任意键继续~" ;
	getch();
	return ;
}

void CEmployee::ThingFun()
{
	system("cls");
	if(m_stEmp.emEmploy == Null)
	{
		m_stEmp.emEmploy = Thing;
		cout << m_stEmp.szName << "请事假被批准!" << endl;
	}
	else
	{
		cout << "你已经签过了!" << endl;
	}
	cout << endl << endl << "按任意键继续~" ;
	getch();
	return ;
}

void CEmployee::SkipFun()
{
	system("cls");
	if(m_stEmp.emEmploy == Null)
	{
		m_stEmp.emEmploy = Skip;
		cout << m_stEmp.szName << "旷工被添加!" << endl;
	}
	else
	{
		cout << "你已经签过了!" << endl;
	}
	cout << endl << endl << "按任意键继续~" ;
	getch();
	return ;
}

void CEmployee::Show()
{
	switch(m_stEmp.emEmploy)
	{
	case Null:
		cout<< "未签" << endl << endl;
		break;

	case Sign:
		cout<< "签到" << endl << endl;
		break;

	case Sick:
		cout<< "病假" << endl << endl;
		break;

	case Thing:
		cout<< "事假" << endl << endl;
		break;

	case Skip:
		cout<< "旷工" << endl << endl;
		break;
	}

	return ;
}

void CEmployee::Display()
{
	cout << "姓名:" << m_stEmp.szName << '\t';
	cout << "性别:" << m_stEmp.szSex << '\t';
	cout << "民族:" << m_stEmp.szNation << '\t';
	cout << "出生日期:" << m_stEmp.stBorn.nYear << '/' << m_stEmp.stBorn.nMonth << '/' << m_stEmp.stBorn.nDay << '\t';
	cout << "学历:" << m_stEmp.szSchoolRecord << '\t';
	cout << "籍贯:" << m_stEmp.szNativePlace << '\t';
	cout << "到职日期:" << m_stEmp.stEOD.nYear << '/' << m_stEmp.stEOD.nMonth << '/' << m_stEmp.stEOD.nDay << '\t';
	cout << "部门:" << m_stEmp.szSection << '\t';
	cout << "职务:" << m_stEmp.szPost << '\t';
	cout << "住址:" << m_stEmp.szAddress << '\t';
	cout << "签到情况:" ;
	Show();

	return ;
}

void CEmployee::ShowName()
{
	cout << "姓名:" << m_stEmp.szName << '\t';
	cout << "签到情况:";
	Show();

	return ;
}

char* CEmployee::GetName()
{
	return m_stEmp.szName;
}

void CEmployee::AmName(char* _szName)
{
	strcpy(m_stEmp.szName, _szName);
}

void CEmployee::AmBorn(int _nYear, int _nMonth, int _nDay)
{
	m_stEmp.stBorn.nYear = _nYear;
	m_stEmp.stBorn.nMonth = _nMonth;
	m_stEmp.stBorn.nDay = _nDay;

	return ;
}

void CEmployee::AmEOD(int _nYear, int _nMonth, int _nDay)
{
	m_stEmp.stEOD.nYear = _nYear;
	m_stEmp.stEOD.nMonth = _nMonth;
	m_stEmp.stEOD.nDay = _nDay;

	return ;
}

void CEmployee::AmSex(char* _pszch)
{
	strcpy(m_stEmp.szSex, _pszch);

	return ;
}

void CEmployee::AmszAddress(char* _pszch)
{
	strcpy(m_stEmp.szAddress, _pszch);

	return ;
}

void CEmployee::AmszNation(char* _pszch)
{
	strcpy(m_stEmp.szNation, _pszch);

	return ;
}


void CEmployee::AmszNativePlace(char* _pszch)
{
	strcpy(m_stEmp.szNativePlace, _pszch);

	return;
}

void CEmployee::AmszPost(char* _pszch)
{
	strcpy(m_stEmp.szPost, _pszch);

	return ;
}

void CEmployee::AmszSchoolRecord(char* _pszch)
{
	strcpy(m_stEmp.szSchoolRecord, _pszch);

	return;
}

void CEmployee::AmszSection(char* _pszch)
{
	strcpy(m_stEmp.szSection, _pszch);

	return ;
}

void CEmployee::AmSign(int _nNum)
{
	switch(_nNum)
	{
	case 0:
		m_stEmp.emEmploy = Null;
		break;
	case 1:
		m_stEmp.emEmploy = Sign;
		break;
	case 2:
		m_stEmp.emEmploy = Sick;
		break;
	case 3:
		m_stEmp.emEmploy = Thing;
		break;
	case 4:
		m_stEmp.emEmploy = Skip;
		break;
	default:
		cout << "系统问题" << endl;
		break;
	}
}

istream& operator >>(istream& _in, CEmployee& _obj)
{
	char szch[20] = "";
	int nYear = 0;
	int nMonth = 0;
	int nDay = 0;
	int nSign = 0;

	_in >> szch;
	_obj.AmName(szch);
	_in >> szch;
	_obj.AmSex(szch);
	_in >> szch;
	_obj.AmszNation(szch);
	_in >> nYear >> nMonth >> nDay;
	_obj.AmBorn(nYear, nMonth, nDay);
	_in >> szch;
	_obj.AmszSchoolRecord(szch);
	_in >> szch;
	_obj.AmszNativePlace(szch);

	_in >> nYear >> nMonth >> nDay;
	_obj.AmEOD(nYear, nMonth, nDay);

	_in >> szch;
	_obj.AmszSection(szch);
	
	_in >> szch;
	_obj.AmszPost(szch);

	_in >> szch;
	_obj.AmszAddress(szch);
	
	_in >> nSign;
	_obj.AmSign(nSign);
	return _in;
}

char* CEmployee::GetNation()
{
	return m_stEmp.szNation;
}

char* CEmployee::GetSchoolRecord()
{
	return m_stEmp.szSchoolRecord;
}

char* CEmployee::GetSex()
{
	return m_stEmp.szSex;
}

char* CEmployee::GetAddress()
{
	return m_stEmp.szAddress;
}

char* CEmployee::GetNativePlace()
{
	return m_stEmp.szNativePlace;
}

char* CEmployee::GetPost()
{
	return m_stEmp.szPost;
}

char* CEmployee::GetSection()
{
	return m_stEmp.szSection;
}

int CEmployee::GetYear() const
{
	return m_stEmp.stBorn.nYear;
}

int CEmployee::GetMont() const
{
	return m_stEmp.stBorn.nMonth;
}

int CEmployee::GetDay() const
{
	return m_stEmp.stBorn.nDay;
}

int CEmployee::GetY() const
{
	return m_stEmp.stEOD.nYear;
}

int CEmployee::GetM() const
{
	return m_stEmp.stEOD.nMonth;
}

int CEmployee::GetD() const
{
	return m_stEmp.stEOD.nDay;
}

int CEmployee::GetSign()
{
	return m_stEmp.emEmploy;
}

ostream& operator <<(ostream& _out, CEmployee& _obj)
{
	_out << _obj.GetName() <<endl;
	_out << _obj.GetSex() << endl;
	_out << _obj.GetNation() << endl;
	_out << _obj.GetYear() << endl;
	_out << _obj.GetMont() << endl;
	_out << _obj.GetDay() << endl;
	_out << _obj.GetSchoolRecord() << endl;
	_out << _obj.GetNativePlace() << endl;
	_out << _obj.GetY() << endl;
	_out << _obj.GetM() << endl;
	_out << _obj.GetD() << endl;
	_out << _obj.GetSection() << endl;
	_out << _obj.GetPost() << endl;
	_out << _obj.GetAddress() << endl;
	_out << _obj.GetSign() << endl;

	return _out;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -