📄 menu.h
字号:
/*
*/
#ifndef MENU_H
#define MENU_H
#include <stdio.h>
#include <iostream>
#include <sstream>
#include<fstream>
#include <string>
#include "conio.h"
#include "employee.h"
extern CEmployee *HeadEmployee;
using namespace std;
class CMenu
{
public:
CMenu();/////////////////////////////////////构造函数
void Login( void );//////////////////////////用户登录
void Op_SimpleUser( void );//////////////////进入普通用户登录界面
void Op_SalaryManager( void );/////////////进入工资管理员登录界面
void Op_Administrator( void );///////////////进入系统管理员登录界面
void Sort_Menu();////////////////////////////进入排序菜单
void Search_Menu();//////////////////////////进入查找菜单
void Count_Menu();///////////////////////////进入统计菜单
bool CheckUser(int identity);////////////////验证用户身份
bool IsDigit( string str );//////////////////////判断输入是否为数字
string GetUserPW(char *filePath,string userName);//从数据文件获取用户密码
string GetUserInputPassword();////////////////////获得用户输入密码
void Exit();/////////////////////////////////////退出方法
void Help();/////////////////////////////////////帮助方法
void static SaveFile(string filePath)
{
///////////////////////////////////////////完整员工信息文件位置
string str=filePath+"\\Employee.txt";
char *file_emp=new char[str.length()+1];
for(int i=0;i<str.length();i++)
file_emp[i]=str[i];
file_emp[str.length()]='\0';/////////////字符串结束标志
///////////////////////////////////////////完整员工工资信息文件位置
str=filePath+"\\Salary.txt";
char *file_sal=new char[str.length()+1];
for(int j=0;j<str.length();j++)
file_sal[j]=str[j];
file_sal[str.length()]='\0';/////////////字符串结束标志
ofstream out_emp(file_emp);
ofstream out_sal(file_sal);
for(CEmployee *emp=HeadEmployee->next;emp!=NULL;emp=emp->next)////////////////////写入文件
{
out_emp<<emp->m_sSalaryCardId<<" ";
out_emp<<emp->m_sIdentityId<<" ";
out_emp<<emp->m_sName<<" ";
out_emp<<emp->m_cSex<<" ";
out_emp<<emp->m_iAge<<" ";
out_emp<<emp->m_iWorkAge<<" ";
out_emp<<emp->m_sDepartment<<" ";
out_emp<<emp->m_sTechPost<<" ";
out_emp<<emp->m_sTechPostNum<<" ";
out_emp<<emp->m_sHomePhone<<" ";
out_emp<<emp->m_sMobilePhone<<endl;
out_sal<<emp->m_cSalary.m_sSalaryCardId<<" ";
out_sal<<emp->m_cSalary.m_fWaterRate<<" ";
out_sal<<emp->m_cSalary.m_fElecCost<<" ";
out_sal<<emp->m_cSalary.m_iCleanCost<<" ";
out_sal<<emp->m_cSalary.m_iTVCost<<" ";
out_sal<<emp->m_cSalary.m_fBasePay<<" ";
out_sal<<emp->m_cSalary.m_fDutyPay<<" ";
out_sal<<emp->m_cSalary.m_fAssistance<<" ";
out_sal<<emp->m_cSalary.m_fTax<<" ";
out_sal<<emp->m_cSalary.m_fSalary<<endl;
}
out_emp.close();
out_sal.close();
delete []file_emp;
delete []file_sal;
}
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -