迷你人事管理系统

exe测试程序链接:
https://pan.baidu.com/share/init?surl=nNLbL3N1_jG_t0Ppg6_0gQ
提取码:qja5
系统菜单
头文件Warehouse.h

#pragma once 
#include<iostream>
#include<iomanip>
#include<string>
//关联容器map储存每个人员信息
#include<map>
#include<windows.h>
#include<fstream>
#include<sstream>
#include<mmsystem.h>
#pragma comment(lib,"winmm.lib")
using namespace std;
class Ad_Te_staff;
pair<string, int>p;

//map容器的一个全局对象,键是名字和工号组合的结构体对象
map<pair<string, int>, Ad_Te_staff>imap;
map<pair< string, int >, Ad_Te_staff>::iterator it;

//名字,工号,容错字符串,编号的全局变量
string name1, warning_eat;
int num, countall = 0;

头文件Position.h

#pragma once

//Person类(基类)
class Person
{
protected:	
int number = 0, birthday = 0, age = 0;	string name = "", sex = "", party_mem = "";	int sexx = 0, party_memm = 0;
public:	//名字->年龄->生日->工号->性别->是否党员	Person(string name = "", int age = 0, int birthday = 0, int number = 0, int sex = 0, int party_mem = 0)	
{		
this->name = name;		
this->age = age;		
this->birthday = birthday;		
this->number = number;		
sexx = sex;		
party_memm = party_mem;	
if (sex == 1)this->sex = "男";		
else if (sex == 2)this->sex = "女";		
else cout << "warning" << endl;		
if (party_mem == 1)this->party_mem = "党员";		
else if (party_mem == 2)this->party_mem = "非党员";		
else cout << "warning" << endl;
}
};
//行政人员 类(子类)
class Administrative_staff :virtual public Person
{
protected:	
string ad_st = "行政人员";	
int ad_subsidy = 3000;	
int ad_salary = 0;//工资
int ad_joining_time = 0;//入伍时间
public:	
Administrative_staff() {}	
Administrative_staff(string a, int b, int c, int d, int e, int f, int ad_salary, int ad_joining_time) :Person(a, b, c, d, e, f)	
{		
this->ad_salary = ad_salary + ad_subsidy;		
this->ad_joining_time = ad_joining_time;	
}
};

//教师 类(子类)
class Teacher :virtual public Person
{
protected:	
string teach = "教师";	
string Job_title = "";//职称	
int Job_t = 0;//职称判断	
int te_salary = 0;//工资	
int te_joining_time = 0;//入伍时间
public:	
Teacher() {}	
Teacher(string a, int b, int c, int d, int e, int f, int Job_t, int te_joining_time) :Person(a, b, c, d, e, f)	
{		
this->Job_t = Job_t;		
this->te_joining_time = te_joining_time;		
switch (Job_t)		
{		
case 1:te_salary = 10000; Job_title = "正高"; break;		
case 2:te_salary = 8000; Job_title = "副高"; break;		
case 3:te_salary = 6000; Job_title = "中级"; break;		
case 4:te_salary = 4000; Job_title = "初级"; break;		
case 5:te_salary = 2000; Job_title = "见习"; break;		
}	
}
};
//教师兼行政 人员 类 (多派生类)
class Ad_Te_staff :public Administrative_staff, public Teacher, virtual public Person
{	
string ad_te = "教师兼行政";	
int salary = te_salary + ad_subsidy;	
int AT_joining_time = 0;
public:	
Ad_Te_staff() {}	
Ad_Te_staff(string a, int b, int c, int d, int e, int f, int g, int h, string i, int j, int k, int l, int m, int n, int o, int p, string q, int r, int s, int t, int u, int v, int AT_joining_time = 0)		:Teacher(a, b, c, d, e, f, g, h), Administrative_staff(i, j, k, l, m, n, o, p), Person(q, r, s, t, u, v)	
{		
this->AT_joining_time = AT_joining_time;	
}	
int sta1()//检测当前对象党员值(用于统计,以下四个都是)	
{		
if (party_mem == "党员")return 1;		
else return 0;	
}	
int sta2()//检测性别值	
{		
if (sex == "女")return 1;		
else return 0;	
}
int sta3()//检测年龄段
	{
		if (age >= 18 && age < 25)return 1;
		else if (age >= 25 && age < 35)return 2;
		else if (age >= 35 && age < 45)return 3;
		else if (age >= 45 && age < 55)return 4;
		else return 0;
	}
	int sta4()
	{
		if (te_joining_time != 0 || AT_joining_time != 0)
		{
			switch (Job_t)
			{
			case 1:return 1; break;
			case 2:return 2; break;
			case 3:return 3; break;
			case 4:return 4; break;
			case 5:return 5; break;
			}
		}
		return 0;
	}
	int output_judge()//判断实例化对象为何职务
	{
		if (ad_salary != 3000)return 1;
		else if (te_joining_time != 0)return 2;
		else if (AT_joining_time != 0)return 3;
		else return 0;
	}
	string visit();//这两个函数实现在最底下,用于输出查询结果
	int edit();//用于编辑
//以下是获取类内成员值的对应函数
	string find_name() { return name; }
	//基本
	int find_age() { return age; }
	int find_birthday() { return birthday; }
	int find_num() { return number; }
	int find_sex() { return sexx; }
	int find_party_mem() { return party_memm; }
	//行政
	int find_ad_salary() { return ad_salary - 3000; }
	int find_ad_subsidy() { return ad_subsidy; }
	int find_ad_joining_time() { return ad_joining_time; }
	//教师
	int find_Job_t() { return Job_t; }
	string find_Job_title() { return Job_title; }
	int find_te_salary() { return te_salary; }
	int find_te_joining_time() { return te_joining_time; }
	//行政教师
	int find_salary() { return salary; }
	int find_AT_joining_time() { return AT_joining_time; }
};

头文件Function.h

#pragmaonce
#include"Warehouse.h"
#include"Position.h"
// 系统功能类 
class Function
{
public:	
void Home();//首页	
void Add();//添加	
void Deleted();//删除	
void Seek();//查询	
void Edit();//编辑	
void Statistics();//统计	
void Save();//保存	
void Show();//显示所有	
void Del_all();//删除所有
};
//"<<"的重载函数,用于保存到文件的输出void operator<<(ofstream& output_txt,Ad_Te_staff& b)
Function operator<<(ofstream& output_txt, Ad_Te_staff& b)
{	
output_txt << "编号: " << ++countall << " ";	//先判断此对象的身份	
int t = (*it).second.output_judge();	//输出基础值到output_txt输出流变量(设置右对齐,域宽 与 填充字符)	
if (t == 1)output_txt << setiosflags(ios::right) << setw(7) << setfill(' ') << "行政人员";	
else if (t == 2)output_txt << setiosflags(ios::right) << setw(7) << setfill(' ') << "教职人员";	
else if (t == 3)output_txt << setiosflags(ios::right) << setw(7) << setfill(' ') << "行政教师";	output_txt << setiosflags(ios::right) << setw(12) << setfill(' ') << (*it).second.find_name();	output_txt << setiosflags(ios::right) << setw(7) << setfill(' ') << (*it).second.find_age();	output_txt << setiosflags(ios::right) << setw(12) << setfill(' ') << (*it).second.find_birthday();	output_txt << setiosflags(ios::right) << setw(10) << setfill(' ') << (*it).second.find_num();	
int t0 = (*it).second.find_sex();	
if (t0 == 1) output_txt << setiosflags(ios::right) << setw(10) << setfill(' ') << "男";	
else if (t0 == 2)output_txt << setiosflags(ios::right) << setw(10) << setfill(' ') << "女";	
int t1 = (*it).second.find_party_mem();	
if (t1 == 1)output_txt << setiosflags(ios::right) << setw(16) << setfill(' ') << "党员";	
else if (t1 == 2)output_txt << setiosflags(ios::right) << setw(15) << setfill(' ') << "非党员";	
if (t == 1)//行政人员身份	
{		
output_txt << setiosflags(ios::right) << setw(17) << "无";		
output_txt << setiosflags(ios::right) << setw(9) << (*it).second.find_ad_salary();		
output_txt << setiosflags(ios::right) << setw(9) << (*it).second.find_ad_subsidy();		
output_txt << setiosflags(ios::right) << setw(12) << (*it).second.find_ad_joining_time();	
}	
else if (t == 2)//教师身份	
{		
output_txt << setiosflags(ios::right) << setw(15) << (*it).second.find_Job_title();		
output_txt << setiosflags(ios::right) << setw(9) << (*it).second.find_te_salary();		
output_txt << setiosflags(ios::right) << setw(12) << "无";		
output_txt << setiosflags(ios::right) << setw(13) << (*it).second.find_te_joining_time();	
}	
else if (t == 3)//行政教师身份	
{		
output_txt << setiosflags(ios::right) << setw(15) << setfill(' ') << (*it).second.find_Job_title();		
output_txt << setiosflags(ios::right) << setw(9) << setfill(' ') << (*it).second.find_salary();		
output_txt << setiosflags(ios::right) << setw(9) << setfill(' ') << (*it).second.find_ad_subsidy();		
output_txt << setiosflags(ios::right) << setw(13) << setfill(' ') << (*it).second.find_AT_joining_time();	
}	
output_txt << endl;
}
//重载>>的函数,用于从文件获取数据并存入map容器void operator>>(ifstream& input_txt, Ad_Te_staff& b)
Function operator>>(ifstream& input_txt, Ad_Te_staff& b)
{	
string ignore = "", judge = "", name_txt = "";	
int age_txt = 0, birthday_txt = 0, num_txt = 0;	string sex_txt = "", partym_txt = "";	
int sex = 0, partym = 0;	
int ig1 = 0, salary = 0, Joining_time = 0, Jobt = 0;	string Jobt_txt = "", m;	
cout << "请输入文件所在盘:" << endl;	
cout << "D->D盘  " << "E->E盘  " << "F->F盘  " << endl << endl;	cout << "输入区:";	
string a = "";	
cin >> a;	
if (a == "" && a != "D" && a != "E" && a != "F")	
{		
system("cls");		
cout << "输入错误(请检查输入格式)" << endl << endl;		
system("pause");		
return;
}	
system("cls");	
cout << "请输入文件名字:" << endl << endl;	
cout << "输入区:";	
string q = "";	
cin >> q;	
system("cls");	
string way = a + ":\\" + q + ".txt";	
input_txt.open(way, ios::in);	
if (!input_txt) //若无法打开,则显示错误并返回	
{		
system("cls");		
cout << "找不到此路径(请检查磁盘或文件是否存在)" << endl;		
system("pause");		
exit(1);	
}	
getline(input_txt, m);	
for (; getline(input_txt, m);)//判断所在行是否有值的循环	
{		
istringstream str(m);//定义字符串流临时变量		
//按照设计格式截取对应片段(用于实例化对象并存进容器imap)		
str >> ignore >> ig1 >> judge;		
str >> name_txt >> age_txt >> birthday_txt >> num_txt;		
str >> sex_txt >> partym_txt;		
if (sex_txt == "男")sex = 1;		
else if (sex_txt == "女")sex = 2;		
if (partym_txt == "党员")partym = 1;		
else if (partym_txt == "非党员")partym = 2;		
if (judge == "行政人员")		
{			
str >> ignore >> salary >> ig1 >> Joining_time;			
Ad_Te_staff obj("", 0, 0, 0, 0, 0, 0, 0, name_txt, age_txt, birthday_txt, num_txt, sex, partym, salary, Joining_time, name_txt, age_txt, birthday_txt, num_txt, sex, partym, 0);			
pair<string, int>one(name_txt, num_txt);			
imap.insert(make_pair(one, obj));		
}		
else if (judge == "教职人员")		
{			
str >> Jobt_txt >> ig1 >> ignore >> Joining_time;			
if (Jobt_txt == "正高")Jobt = 1;			
else if (Jobt_txt == "副高")Jobt = 2;			
else if (Jobt_txt == "中级")Jobt = 3;			
else if (Jobt_txt == "初级")Jobt = 4;			
else if (Jobt_txt == "见习")Jobt = 5;			
Ad_Te_staff obj(name_txt, age_txt, birthday_txt, num_txt, sex, partym, Jobt, Joining_time, "", 0, 0, 0, 0, 0, 0, 0, name_txt, age_txt, birthday_txt, num_txt, sex, partym, 0);			
pair<string, int>one(name_txt, num_txt);			
imap.insert(make_pair(one, obj));		
}		
else if (judge == "行政教师")		
{			
str >> Jobt_txt >> ig1 >> ig1 >> Joining_time;			
if (Jobt_txt == "正高")Jobt = 1;			
else if (Jobt_txt == "副高")Jobt = 2;			
else if (Jobt_txt == "中级")Jobt = 3;			
else if (Jobt_txt == "初级")Jobt = 4;			
else if (Jobt_txt == "见习")Jobt = 5;			
Ad_Te_staff obj(name_txt, age_txt, birthday_txt, num_txt, sex, partym, Jobt, 0, name_txt, age_txt, birthday_txt, num_txt, sex, partym, 0, 0, name_txt, age_txt, birthday_txt, num_txt, sex, partym, Joining_time);			
pair<string, int>one(name_txt, num_txt);			
imap.insert(make_pair(one, obj));		
}	
}
}

源文件Func_realize.cpp

#include"Warehouse.h"
#include"Position.h"
#include"Function.h"
//                                       首页void 
Function::Home()
{	
MessageBeep(MB_OK);	
system("cls");	
int a;	
do {		
cin.clear();		
getline(cin, warning_eat);		
system("cls");		
//系统界面		
cout << "<欢迎使用迷你HR系统>" << endl;              		
cout << "<作者:Ayi 版本1.0>" <<endl<< endl;  		
cout << "1->添加信息(Add)" << endl;        		
cout << "2->删除信息(Delete)" << endl;            		
cout << "3->查询人员(Seek)" << endl;         		
cout << "4->编辑信息(Edit)" << endl;           		
cout << "5->统计数据(Count)" << endl;       		
cout << "6->保存文件(Save)" << endl;          		
cout << "7->退出系统(Quit)" << endl;          		
cout << endl << "8->显示全部(Show)" << endl;		
cout  << "9->删除全部(Delete All)" << endl;		
cout <<endl<< "输入区:";                               		
cin >> a;		
system("cls");//调用功能
		switch (a)		
		{		
		case 1:MessageBeep(MB_OK); Add(); break;		
		case 2:MessageBeep(MB_OK); Deleted(); break;		
		case 3:MessageBeep(MB_OK); Seek(); break;		
		case 4:MessageBeep(MB_OK); Edit(); break;		
		case 5:MessageBeep(MB_OK); Statistics(); break;		
		case 6:MessageBeep(MB_OK); Save(); break;		
		case 8:MessageBeep(MB_OK); Show(); break;		
		case 9:MessageBeep(MB_OK);Del_all(); break;		}		
		if (a<1||a>9)		
		{			
		MessageBeep(MB_ICONERROR);			
		cout << "更多功能正在开发中,敬请期待!" << endl;			
		system("pause");			
		system("cls");		}	} 
		while (a != 7);	
		MessageBeep(MB_ICONERROR);	
		cout << "<感谢您的使用和支持>" <<endl<< endl;	
		system("pause");//按任意键继续}                                                   //添加--功能
void Function::Add()
{	
cout << "输入信息" << endl;	
cout << endl << "名字:" ;	
cin >> name1;	
system("cls");//判断名字是否输入重复	
for (it = imap.begin(); it!=imap.end(); it++)	
{		
if (name1== (*it).first.first)break;	
}	
if (it != imap.end())	
{		
MessageBeep(MB_ICONERROR);		
cout << "数据已存在" << endl;		
system("pause");		
system("cls");		
return;	}	
int set[5] = { 0 };	
string show[] = {"年龄:","生日(20001010):","工号:" ,"性别(男:1,女:2):","是否党员(是:1,否:2):"};	for (int i = 0; i < 5; i++)	
{		
cout << "输入信息" << endl;		
cout <<endl<< show[i];		
cin >> set[i];		
system("cls");		
cin.clear();	
getline(cin,warning_eat);	}	
if (set[0] == 0)//检查生日	
{		
MessageBeep(MB_ICONERROR);		
cout << "输入错误(请检查输入格式)" <<endl<< endl;		
system("pause");		
system("cls");		
return;	
}	
if(set[1]==0)//检查生日	
{		
MessageBeep(MB_ICONERROR);
cout << "输入错误(生日输入错误)" << endl << endl;		
system("pause");		
system("cls");		
return;	}	
if (set[2] == 0)//检查工号	
{		
MessageBeep(MB_ICONERROR);		
cout << "输入错误(工号不能为0或字符)" << endl << endl;		
system("pause");		
system("cls");		
return;	}	
if (set[3] != 1 && set[3] != 2)//检查性别	
{		
MessageBeep(MB_ICONERROR);		
cout << "输入错误(性别输入错误)" << endl << endl;		
system("pause");		
system("cls");		
return;	
}	
if (set[4] != 1 && set[4] != 2)//检查党员身份	
{		
MessageBeep(MB_ICONERROR);		
cout << "输入错误(党员身份不明)" << endl << endl;		
system("pause");		
system("cls");		
return;
}	
for (it = imap.begin(); it != imap.end(); it++)//检查工号是否重复	
{		
if (set[2] == (*it).first.second)break;	
}	
if (it != imap.end())	
{		
MessageBeep(MB_ICONERROR);		
cout << "工号已存在" << endl;		
system("pause");		
system("cls");		
return;	
}	
pair<string, int>one(name1,set[2]);//组合名字和工号	
int a=0;	
cout << "添加人员类型:" << endl;	
cout << "1->教师" << endl;	
cout << "2->行政" << endl;	
cout << "3->教师兼行政" << endl;	
cout << endl << "输入区:";	
cin >> a;	
system("cls");	
if (a == 1)	
{		
int a0,a1;		
cout << "选择职称:" << endl;		
cout << "1:正高" << endl;		
cout << "2:副高" << endl;		
cout << "3:中级" << endl;		
cout << "4:初级" << endl;		
cout << "5:见习" << endl;		
cout << endl << "输入区:";		
cin >> a0;		
system("cls");		
cout << "入伍时间(20001010)" << endl;		
cout << endl << "输入区:";		
cin >> a1;	//用教师类的参数,实例化行政教师类,其余成员为默认值		
Ad_Te_staff obj(name1, set[0],set[1], set[2], set[3], set[4], a0, a1,"",0,0,0,0,0,0,0, name1, set[0], set[1], set[2], set[3], set[4],0);		
imap.insert(make_pair(one, obj));		
system("cls");		
MessageBeep(MB_OK);		
cout << "添加成功" << endl;		
system("pause");		
system("cls");		
countall++;	}	
else if (a == 2)	
{		
int b0, b1;		
cout << "输入行政人员工资(单位/元):" << endl;		
cout << endl << "输入区:";		
cin >> b0;		
system("cls");		
cout << "入伍时间(20001010)" << endl;		
cout << endl << "输入区:";		
cin >> b1;//用行政类的参数,实例化行政教师类,其余成员为默认值		
Ad_Te_staff obj("", 0, 0, 0, 0, 0, 0,0,name1, set[0], set[1], set[2],set[3], set[4], b0, b1, name1, set[0], set[1], set[2], set[3], set[4],0);		
imap.insert(make_pair(one, obj));		
system("cls");		
MessageBeep(MB_OK);		
cout << "添加成功" << endl;		
system("pause");		
system("cls");		
countall++;	
}
else if (a == 3)	
{		
int c0,c1;		
cout << "选择职称:" << endl;		
cout << "1:正高" << endl;		
cout << "2:副高" << endl;		
cout << "3:中级" << endl;		
cout << "4:初级" << endl;		
cout << "5:见习" << endl;		
cout << endl << "输入区:";		
cin >> c0;		
system("cls");		
cout << "入伍时间(20001010)" << endl;		
cout << endl << "输入区:";		
cin >>c1;//实例化行政教师类		
Ad_Te_staff obj(name1, set[0], set[1], set[2], set[3], set[4], c0, 0, name1, set[0], set[1], set[2], set[3], set[4], 0, 0,name1, set[0], set[1], set[2], set[3], set[4],c1);		imap.insert(make_pair(one, obj));		
system("cls");		
MessageBeep(MB_OK);		
cout << "添加成功" << endl;		
system("pause");		
system("cls");		
countall++;//编号+1	
}	
else	
{		
MessageBeep(MB_ICONERROR);		
cout << "错误" << endl;		
system("pause");		
system("cls");		
return;	
}
}                                        
//删除--功能
void Function::Deleted()
{	
system("cls");//bool类型变量检查容器是否为空	
bool bo = imap.empty();	
if (bo == true)
	{		
	MessageBeep(MB_ICONERROR);		
	cout << "请先录入"<<endl;		
	system("pause");		
	system("cls");		
	return;	
	}	
	int de12;	
	cout << "根据(1->名字)(2->工号)寻找待删除者." << endl;	
	cout << endl << "输入区:";	
	cin >> de12;	
	if (de12 == 1)//按照名字	
	{		
	int yep;		
	system("cls");		
	cout << "键入待删除者姓名";		
	cout << endl << "输入区:";		
	cin >> name1;	// 自定义类似于find的函数		
	for (it = imap.begin(); it != imap.end(); it++)		
	{			
	if (name1 == (*it).first.first)break;		
	}		
	if (it == imap.end())//当迭代器到了end的位置,表示找不到		
	{			
	system("cls");			
	MessageBeep(MB_ICONERROR);			
	cout << "查无此人" << endl;			
	system("pause");			
	system("cls");			
	return;		}		
	else if (it != imap.end())		
	{			
	system("cls");			
	cout << "已成功找到,确认删除?" << endl;			
	cout << "<1->确认>" << endl<< "<其他->取消>" << endl;			
	cin >> yep;			
	if (yep == 1)			
	{				
	imap.erase(it);//删除迭代器所处位置的值(此处为对象)				
	MessageBeep(MB_OK);				
	cout << "<此人已删除> " << endl;				
	countall--;				
	system("pause");				
	system("cls");			
	}			
	else return;		
	}	
	}	
	else if (de12 == 2)//按照工号	
	{		
	system("cls");		
	cout << "键入待删除者工号";		
	int num;		
	cout << endl << "输入区:";		
	cin >> num;		
	if (num == 0)//检查工号输入格式		
	{			
	getline(cin, warning_eat);			
	system("cls");			
	MessageBeep(MB_ICONERROR);			
	cout << "输入错误(请检查输入格式)" << endl << endl;			
	system("pause");			
	return;		
}		
for (it = imap.begin(); it != imap.end(); it++)		
{			
if (num == (*it).first.second)break;		}		
if (it == imap.end())		
{			
system("cls");			
MessageBeep(MB_ICONERROR);			
cout << "查无此人" << endl;			
system("pause");			
system("cls");			
return;		}		
else if (it != imap.end())		
{			
imap.erase(it);			
MessageBeep(MB_OK);			
cout << "<此人已删除> " << endl;			
system("pause");			
system("cls");			
countall--;		
}	
}	
else	
{		
system("cls");		
MessageBeep(MB_ICONERROR);		
cout << "请输入正确的指令.." <<endl<< endl;		
system("pause");		
system("cls");	}}                                  //查找--功能
void Function::Seek()
{	
bool bo = imap.empty();	
if (bo == true)	
{		
MessageBeep(MB_ICONERROR);		
cout << "请先录入"<<endl;		
system("pause");		
return;	}	
int seek;	
cout << "按名字查找->1" << endl;	
cout << "按工号查找->2" << endl;	
cout << endl << "输入区:";	
cin >> seek;	
if (seek == 1)	
{		
system("cls");		
cout << "输入名字" << endl;		
cout << endl << "输入区:";		
cin >> name1;		
for (it = imap.begin(); it != imap.end(); it++)		
{			
if (name1 == (*it).first.first)break;		
}		
if (it != imap.end())		
{		
//用迭代器指向的对象的visit函数输出对象内部的成员值			
cout<<(*it).second.visit()<<endl;			
system("pause");		
}		
else		
{			
system("cls");			
MessageBeep(MB_ICONERROR);			
cout << "查无此人(请检查您的输入方式)" <<endl<< endl;			
system("pause");		
}		
cin.clear();	
}	
else if (seek == 2)	
{		
system("cls");		
int num;		
cout << "输入工号" << endl;		
cout << endl << "输入区:";		
cin >> num;		
if (num == 0)//检查工号输入格式		
{			
getline(cin, warning_eat);			
system("cls");			
MessageBeep(MB_ICONERROR);			
cout << "输入错误(工号不能为0或字符)" << endl << endl;			
system("pause");			
return;
}		
for (it = imap.begin(); it != imap.end(); it++)		
{			
if (num == (*it).first.second)break;		
}		
if (it != imap.end())		
{			 
cout<<(*it).second.visit()<<endl;			 
system("pause");		
}		
else		
{ 			
system("cls");			
MessageBeep(MB_ICONERROR);			
cout << "查无此人(请检查您的输入方式)" << endl << endl;			
system("pause");		
}		
cin.clear();	
}	
else	
{		
system("cls");		
MessageBeep(MB_ICONERROR);		
cout << "请输入正确的指令.." << endl << endl;		
system("pause");		
cin.clear();	
}
}
                                 //编辑--功能  
void Function::Edit()
{	
system("cls");	
bool bo = imap.empty();	
if (bo == true)	
{		
MessageBeep(MB_ICONERROR);		
cout << "请先录入" << endl;		
system("pause");		
return;	
}	
cout << "名字:(当前版本仅限根据名字寻找并编辑)" << endl;	
cout << endl << "输入区:";	
cin >> name1;	
system("cls");	
string beforename = name1;//保存当前名字的键入值	
for (it = imap.begin(); it != imap.end(); it++)	
{		
if (name1 == (*it).first.first)break;	
}	
if (it != imap.end())	
{		
int beforenum = (*it).second.find_num();		
int op=(*it).second.edit();//op获取返回值,判断当前对象职务身份		
if (beforename != name1)//若名字做出了修改,则进入此if函数,用修改后的名字值作为键,与对应接口函数获取对应值后,重新实例化对象存进imap容器,并删除修改前的键		
{			
int age = (*it).second.find_age();			
int birthday = (*it).second.find_birthday();			
int num = (*it).second.find_num();			
int sex = (*it).second.find_sex();			
int party_mem = (*it).second.find_party_mem();			
if (op != 4) 			
{				
switch (op)				
{				
case 1:				
{					
int ad_salary = (*it).second.find_ad_salary();					
int ad_joining_time = (*it).second.find_ad_joining_time();					
Ad_Te_staff obj("", 0, 0, 0, 0, 0, 0, 0, name1, age, birthday, num, sex, party_mem, ad_salary, ad_joining_time, name1, age, birthday, num, sex, party_mem, 0);					pair<string, int>one(name1, num);					
imap.insert(make_pair(one, obj));				
}				
case 2:				
{					
int Job_t = (*it).second.find_Job_t();					
int te_joining_time = (*it).second.find_te_joining_time();					
Ad_Te_staff obj(name1, age, birthday, num, sex, party_mem, Job_t, te_joining_time, "", 0, 0, 0, 0, 0, 0, 0, name1, age, birthday, num, sex, party_mem, 0);					
pair<string, int>one(name1, num);					
imap.insert(make_pair(one, obj));				
}				
case 3:				
{					
int Job_t = (*it).second.find_Job_t();					
int AT_joining_time = (*it).second.find_AT_joining_time();					
Ad_Te_staff obj(name1, age, birthday, num, sex, party_mem, Job_t, 0, name1, age, birthday, num, sex, party_mem, 0, 0, name1, age, birthday, num, sex, party_mem, AT_joining_time);					pair<string, int>one(name1, num);					
imap.insert(make_pair(one, obj));				
}				
}				
imap.erase(it);			
}		
}		
else if (beforenum != (*it).second.find_num())//若工号做出了修改,则进入此if函数,用修改后的工号值作为键,与对应接口函数获取对应值后,重新实例化对象存进imap容器,并删除修改前的键		
{			
string name2 = (*it).second.find_name();			
int age = (*it).second.find_age();			
int birthday = (*it).second.find_birthday();			
int sex = (*it).second.find_sex();			
int party_mem = (*it).second.find_party_mem();			
if (op != 4)			
{				
switch (op)				
{				
case 1:				
{					
int ad_salary = (*it).second.find_ad_salary();					
int ad_joining_time = (*it).second.find_ad_joining_time();					
Ad_Te_staff obj("", 0, 0, 0, 0, 0, 0, 0, name2, age, birthday, num, sex, party_mem, ad_salary, ad_joining_time, name2, age, birthday, num, sex, party_mem, 0);					pair<string, int>one(name1, num);					
imap.insert(make_pair(one, obj));				
}				
case 2:				
{					
int Job_t = (*it).second.find_Job_t();					
int te_joining_time = (*it).second.find_te_joining_time();					
Ad_Te_staff obj(name2, age, birthday, num, sex, party_mem, Job_t, te_joining_time, "", 0, 0, 0, 0, 0, 0, 0, name2, age, birthday, num, sex, party_mem, 0);					
pair<string, int>one(name1, num);					
imap.insert(make_pair(one, obj));				
}				
case 3:				
{					
int Job_t = (*it).second.find_Job_t();					
int AT_joining_time = (*it).second.find_AT_joining_time();					
Ad_Te_staff obj(name2, age, birthday, num, sex, party_mem, Job_t, 0, name2, age, birthday, num, sex, party_mem, 0, 0, name2, age, birthday, num, sex, party_mem, AT_joining_time);					pair<string, int>one(name1, num);					
imap.insert(make_pair(one, obj));				
}				
}				
imap.erase(it);			
}		
}		
if (op == 4)//若修改的不是作为键的值的名字和工号,返回4则代表修改时有输入错误,编辑失败		
{			
system("cls");			
MessageBeep(MB_ICONERROR);			
cout << "编辑失败(已初始化修改值为0)" << endl;			
cout << endl;			
system("pause");		
}		
else		
{			
system("cls");			
MessageBeep(MB_OK);			
cout << "编辑成功" << endl;			
cout << endl;			
system("pause");		
}	
}	
else	
{		
system("cls");		
MessageBeep(MB_ICONERROR);		
cout << "查无此人(请检查您的输入方式)"<<endl << endl;		
system("pause");	
}	
return;
}                                        
//统计--功能
void Function::Statistics()
{	
system("cls");	
bool bo = imap.empty();	
if (bo == true)	
{		
MessageBeep(MB_ICONERROR);		
cout << "请先录入" << endl;		
system("pause");		
system("cls");		
return;	
}	
//定义变量存放统计值	
int all=0, ad=0, te=0, ad_te=0;	
int partym=0,girl=0;	
int age18_25=0, age25_35=0, age35_45=0, age45_55=0;	
int A=0, B=0, C=0, D=0, E=0;	
for (it = imap.begin(); it != imap.end(); it++)//for循环依次巡视容器内对象的成员值,对此判断并统计	
{		
int t0=(*it).second.output_judge();		
if (t0 == 1)ad++;		
else if (t0== 2)te++;		
else if (t0 == 3) { ad++, te++, ad_te++; }		
int t1 = (*it).second.sta1();		
if (t1 == 1)partym++;		
int t2 = (*it).second.sta2();		
if (t2 == 1)girl++;		
int t3 = (*it).second.sta3();		
if (t3 == 1)age18_25++;		
else if (t3 == 2)age25_35++;		
else if (t3 == 3)age35_45++;		
else if (t3 == 4)age45_55++;		
int t4 = (*it).second.sta4();		
if (t4 == 1)A++;		
else if (t4 == 2)B++;
else if (t4 == 3)C++;		
else if (t4 == 4)D++;		
else if (t4 == 5)E++;	}	
cout << "<统计结果>" << endl;//输出统计结果	
cout << endl;	
cout << "在职总人数:" << imap.size() << " 人" << endl;
cout << "在职行政人员:" << ad << " 人" << endl;	
cout << "在职教师人数:" << te << " 人" << endl;	
cout << "教师兼行政人数:" << ad_te << " 人" << endl;	
cout << "党员人数:" << partym << " 人" << endl;
cout << "女工人数:" << girl << " 人" << endl;	
cout << endl;	cout << "年龄段人数:" << endl;	
cout << "18~25: " << age18_25 << " 人" << endl;	
cout << "25~35: " << age25_35 << " 人" << endl;	
cout << "35~45: " << age35_45 << " 人" << endl;	
cout << "45~55: " << age45_55 << " 人" << endl;	
cout << endl;	cout << "职称人数:" << endl;	
cout << "正高:" << A << " 人" << endl;	
cout << "副高:" << B << " 人" << endl;	
cout << "中级:" << C<< " 人" << endl;	
cout << "初级:" << D<< " 人" << endl;	
cout << "见习:" << E<< " 人" << endl;	
cout << endl;	system("pause");}                        
          //保存--功能
void Function::Save()
{	
system("cls");	
countall = 0;	
cout << "请输入文件保存盘:"<<endl;	
cout  << "D->D盘  " << "E->E盘  " << "F->F盘  " <<endl<< endl;	cout << "输入区:";	
string a="";	
cin >> a;	
if (a == ""&&a!="D"&&a!="E"&&a!="F")	
{ 		
system("cls");		
cout << "输入错误(请检查输入格式)" <<endl<< endl;		
system("pause");		
return;	
}	
system("cls");	
cout << "请输入文件名字:" << endl;	
cout << endl << "输入区:";	
string b;	
cin >> b;	
system("cls");	
ofstream output_txt;	
string way=a+":\\"+b+".txt";	
output_txt.open(way, ios::out|ios::trunc);//ios::trunc-->打开一个文件,当其存在时删除里面的内容,否则建立此文件	
if (!output_txt) //若无法打开,则显示错误并返回	
{		
system("cls");		
cout << "找不到此路径(请检查磁盘是否存在)" << endl;		
system("pause");		
return;	
}	
output_txt << "            " << "职务             " << "姓名     " << "年龄      " << "出生日期     " << "工号     " << "性别     " << "社会身份    " << "教师职规       " << "工资      " << "补贴      " << "入伍时间" << endl;	
for (it = imap.begin(); it != imap.end(); it++)
	{		
	output_txt << (*it).second;//<<重载,左操作数:输入流对象,右操作数:行政教师类的对象	
	}	
MessageBeep(MB_OK);	
cout << "保存成功(文件位置:"<< way<<")" << endl;	system("pause");	
system("cls");}
int Ad_Te_staff::edit()//编辑函数
{	
system("cls");	
int s=0,re=0;	
int a_sex,a_p;	
cout << "1->名字(当前值: " << name << ")" << endl;	
cout << "2->年龄(当前值: " << age << ")" << endl;	
cout << "3->生日(当前值: " << birthday << ")" << endl;	
cout << "4->工号(当前值: " << number << ")" << endl;	
cout << "5->性别(当前值: " << sex << ")" << endl;	
cout << "6->身份(当前值: " << party_mem << ")" << endl;	
if (ad_salary != 3000)	
{		
cout << "7->工资(当前值: " << ad_salary << ")" << endl;		
cout << "8->入伍时间(当前值: " << ad_joining_time << ")" << endl;		
cout <<endl<< "输入区:";		
cin >> s;		
if (s < 1 || s > 8)		
{			
system("cls");			
cout << "无法识别的操作(请检查输入格式)" << endl;			
cout << "数字1->继续" << endl;			
cout << "其他键->返回菜单" << endl << endl;			
system("pause");			
int w;			
cin >> w;			
if (w == 1)edit();			
else return 4;		
}		
system("cls");		
switch (s)		
{		
case 1:cout << "修改值:"; cin >> name1; re = 1; break;//return 1		
case 2:			
cout << "修改值:";			
cin >> age; 			
if (age == 0)			
{				
getline(cin, warning_eat);				
system("cls");				
MessageBeep(MB_ICONERROR);			
cout << "输入错误(请检查输入格式)" << endl << endl;				
system("pause");				
re=4;			
}			
break;		
case 3:			
cout << "修改值:"; 			
cin >> birthday; 			
if (birthday == 0)			
{				
getline(cin, warning_eat);				
system("cls");				
MessageBeep(MB_ICONERROR);				
cout << "输入错误(请检查输入格式)" << endl << endl;				
system("pause");				
re = 4;			
}			
break;		
case 4:
cout << "修改值:"; 
cin >> num; 
re = 1; 
 break;		
 case 5:			
 cout << "修改值";			
 cout << "(男:1,女:2):";			
 cin >> a_sex;			
 if (a_sex == 1)sex = "男";			
 else if (a_sex == 2)sex = "女";			
 else			
 {				
 getline(cin, warning_eat);				
 system("cls");				
 MessageBeep(MB_ICONERROR);				
cout << "输入错误(请检查输入格式)" << endl << endl;				
system("pause");				
re = 4;			
}break;		
case 6:			
cout << "修改值";			
cout << "(1->党员,2->非党员):";			
cin >> a_p;			
if (a_p == 1)party_mem = "党员";			
else if (a_p == 2)party_mem = "非党员";			
else 			
{				
getline(cin, warning_eat);				
system("cls");				
MessageBeep(MB_ICONERROR);				
cout << "输入错误(请检查输入格式)" << endl << endl;				
system("pause");				
re = 4;			
}			break;		
case 7:			
cout << "修改值:"; 			
cin >> ad_salary;			
if (ad_salary == 0)			
{				
getline(cin, warning_eat);				
system("cls");				
MessageBeep(MB_ICONERROR);				
cout << "工资不能这么写(请检查输入格式)" << endl << endl;				
system("pause");				
return 4;			
}			
ad_salary = ad_salary + ad_subsidy; break;		
case 8:cout << "修改值:";			
cin >> ad_joining_time;			
if (ad_joining_time == 0)			
{				
getline(cin, warning_eat);			
system("cls");				
MessageBeep(MB_ICONERROR);				
cout << "输入错误(请检查输入格式)" << endl << endl;				
system("pause");				
re = 4;			
}			
break;		
}	
}	
else if (te_joining_time != 0)	
{		
cout << "7->职称(当前值: " << Job_title << ")" << endl;		
cout << "8->入伍时间(当前值: " << te_joining_time << ")" << endl;		
cout << endl << "输入区:";		
cin.clear();		
cin >> s;		
if (s <1|| s > 8)
	{			
	system("cls");			
	cout << "无法识别的操作(请检查输入格式)"  << endl;			
	cout << "数字1->继续" << endl;			
	cout << "其他键->返回菜单" << endl << endl;			
	system("pause");			
	int w;			
	cin >> w;			
	if (w == 1)edit();			
	else return 4;		
	}		
	system("cls");		
	switch (s)		
	{		
	case 1:cout << "修改值:"; cin >> name1; re = 2; break;//return 2		
	case 2:			
	cout << "修改值:"; 			
	cin >> age; 			
	if (age == 0)			
	{				
	getline(cin, warning_eat);			
	system("cls");				
	MessageBeep(MB_ICONERROR);				
	cout << "输入错误(请检查输入格式)" << endl << endl;				
	system("pause");				
	re = 4;			
	}			break;		
	case 3:			
	cout << "修改值:"; 			
	cin >> birthday;			
	if (birthday == 0)			
	{				
	getline(cin, warning_eat);				
	system("cls");				
	MessageBeep(MB_ICONERROR);				
	cout << "输入错误(请检查输入格式)" << endl << endl;				
	system("pause");				
	re = 4;			}			
	break;		
	case 4:cout << "修改值:"; cin >> num; re = 2; break;		
	case 5:			
	cout << "修改值";			
	cout << "(男:1,女:2):";			
	cin >> a_sex;			
	if (a_sex == 1)sex = "男";			
	else if (a_sex == 2)sex = "女";			
	else 			
	{				
	getline(cin, warning_eat);				
	system("cls");				
	MessageBeep(MB_ICONERROR);				
	cout << "输入错误(请检查输入格式)" << endl << endl;				
	system("pause");				
	re = 4;			
	}			
	break;		
	case 6:			
	cout << "修改值";			
	cout << "(1->党员,2->非党员):";			
	cin >> a_p;			
	if (a_p == 1)party_mem = "党员";			
	else if (a_p == 2)party_mem = "非党员";			
	else			
	{				
	getline(cin, warning_eat);				
	system("cls");				
	MessageBeep(MB_ICONERROR);				
	cout << "输入错误(请检查输入格式)" << endl << endl;				
	system("pause");				
	re = 4;			
	}			break;		
	case 7:			
	cout << "修改值:" << endl;			
	cout << "1:正高" << endl;			
	cout << "2:副高" << endl;			
	cout << "3:中级" << endl;			
	cout << "4:初级" << endl;			
	cout << "5:见习" << endl;			
	cin >> Job_t;			
	if (Job_t == 0)			
	{
				getline(cin, warning_eat);				
				system("cls");				
				MessageBeep(MB_ICONERROR);				
				cout << "输入错误(请检查输入格式)" << endl << endl;				
				system("pause");				
				return 4;			}			
				switch (Job_t)			
				{			
				case 1:te_salary = 10000; Job_title = "正高"; break;		
				case 2:te_salary = 8000; Job_title = "副高"; break;			
				case 3:te_salary = 6000; Job_title = "中级"; break;			
				case 4:te_salary = 4000; Job_title = "初级"; break;			
				case 5:te_salary = 2000; Job_title = "见习";
				break;			
				}			
				break;		
	case 8:cout << "修改值:"; 			
	cin >> te_joining_time;			
	if (te_joining_time == 0)			
	{				
	getline(cin, warning_eat);				
	system("cls");				
	MessageBeep(MB_ICONERROR);				
	cout << "输入错误(请检查输入格式)" << endl << endl;				
	system("pause");				
	re = 4;			
	}			
	break;		
	}	
	}	
else if (AT_joining_time != 0)	
{		
cout << "7->职称(当前值: " << Job_title << ")" << endl;		
cout << "8->入伍时间(当前值: " << AT_joining_time << ")" << endl;		
cout << endl << "输入区:";		
cin >> s;		
if (s < 1 || s > 8)		
{			
system("cls");			
cout << "无法识别的操作(请检查输入格式)" << endl;			
cout << "数字1->继续" << endl;			
cout << "其他键->返回菜单" << endl << endl;			
system("pause");			
int w;			
cin >> w;			
if (w == 1)edit();			
else return 4;		
}		
system("cls");		
switch (s)		
{		
case 1:cout << "修改值:"; cin >> name1;re=3; break;		
case 2:			
cout << "修改值:"; 			
cin >> age; 			
if (age == 0)			
{				
getline(cin, warning_eat);				
system("cls");				
MessageBeep(MB_ICONERROR);				
cout << "输入错误(请检查输入格式)" << endl << endl;				
system("pause");				
re = 4;			
}			
break;		
case 3:			
cout << "修改值:"; 			
cin >> birthday; 			
if (birthday == 0)			
{				
getline(cin, warning_eat);				
system("cls");				
MessageBeep(MB_ICONERROR);				
cout << "输入错误(请检查输入格式)" << endl << endl;				
system("pause");				
re = 4;			
}			
break;		
case 4:cout << "修改值:"; cin >> num; re = 3; break;		
case 5:			
cout << "修改值";			
cout << "(男:1,女:2):";			
cin >> a_sex;			
if (a_sex == 1)sex = "男";			
else if (a_sex == 2)sex = "女";			
else			
{				
getline(cin, warning_eat);				
system("cls");				
MessageBeep(MB_ICONERROR);				
cout << "输入错误(请检查输入格式)" << endl << endl;				
system("pause");				
re = 4;			
}			 
break;		
case 6:			
cout << "修改值";			
cout << "(1->党员,2->非党员):";			
cin >> a_p;			
if (a_p == 1)party_mem = "党员";			
else if (a_p == 2)party_mem = "非党员";			
else			
{				
getline(cin, warning_eat);				
system("cls");				
MessageBeep(MB_ICONERROR);				
cout << "输入错误(请检查输入格式)" << endl << endl;				
system("pause");				
re = 4;			
}			break;		
case 7:			
cout << "修改值:" << endl;			
cout << "1->正高" << endl;			
cout << "2->副高" << endl;
	cout << "3->中级" << endl;			
	cout << "4->初级" << endl;			
	cout << "5->见习" << endl;			
	cin >> Job_t;			
	if (Job_t == 0)			
	{				
	getline(cin, warning_eat);				
	system("cls");				
	MessageBeep(MB_ICONERROR);				
	cout << "输入错误(请检查输入格式)" << endl << endl;				
	system("pause");				
	return 4;			
	}			
	switch (Job_t)			
	{			
	case 1:te_salary = 10000; Job_title = "正高"; break;//???			
	case 2:te_salary = 8000; Job_title = "副高"; break;			
	case 3:te_salary = 6000; Job_title = "中级"; break;			
	case 4:te_salary = 4000; Job_title = "初级"; break;			
	case 5:te_salary = 2000; Job_title = "见习"; break;			
	}			
	break;		
	case 8:			
	cout << "修改值:"; 			
	cin >> AT_joining_time; 			
	if (AT_joining_time == 0)			
	{				
	getline(cin, warning_eat);				
	system("cls");				
	MessageBeep(MB_ICONERROR);				
	cout << "输入错误(请检查输入格式)" << endl << endl;				
	system("pause");				
	re = 4;			
	}			
	break;		
	}	
	}	
	else	
	{	  
	  MessageBeep(MB_ICONERROR);		
	  cout << "未知错误" << endl;		
	  system("pause");		
	  system("cls");	
	  }	
	  return re;
	  }
string Ad_Te_staff::visit()//输出查询对象值函数
	{	
	system("cls");	
	if (ad_salary != 3000)	
	{		
	cout << setiosflags(ios::right) << setw(10) << setfill(' ') << "姓名";		
	cout << setiosflags(ios::right) << setw(7) << setfill(' ') << "工号";		
	cout << setiosflags(ios::right) << setw(7) << setfill(' ') << "年龄";		
	cout << setiosflags(ios::right) << setw(7) << setfill(' ') << "性别";		
	cout << setiosflags(ios::right) << setw(14) << setfill(' ') << "社会身份" ;		
	cout << setiosflags(ios::right) << setw(14) << setfill(' ') << "出生日期" ;		
	cout << setiosflags(ios::right) << setw(12) << setfill(' ') << "职务";		
	cout << setiosflags(ios::right) << setw(11) << setfill(' ') << "工资";		
	cout << setiosflags(ios::right) << setw(10) << setfill(' ') << "行政补贴";		
	cout << setiosflags(ios::right) << setw(13) << setfill(' ') << "入伍时间" << endl;		
	cout << setiosflags(ios::right) << setw(10) << setfill(' ') << name;		
	cout << setiosflags(ios::right) << setw(7) << setfill(' ') << number;		
	cout << setiosflags(ios::right) << setw(7) << setfill(' ') << age;		
	cout << setiosflags(ios::right) << setw(7) << setfill(' ') << sex;		
	cout << setiosflags(ios::right) << setw(14) << setfill(' ') << party_mem;		
	cout << setiosflags(ios::right) << setw(14) << setfill(' ') << birthday;		
	cout << setiosflags(ios::right) << setw(14) << setfill(' ') << ad_st;		
	cout << setiosflags(ios::right) << setw(9) << setfill(' ') << ad_salary;		
	cout << setiosflags(ios::right) << setw(9) << setfill(' ') << ad_subsidy;		
	cout << setiosflags(ios::right) << setw(14) << setfill(' ') << ad_joining_time << endl;	}	else if (te_joining_time != 0)	
	{		
	cout << setiosflags(ios::right) << setw(10) << setfill(' ') << "姓名";		
	cout << setiosflags(ios::right) << setw(7) << setfill(' ') << "工号";		
	cout << setiosflags(ios::right) << setw(7) << setfill(' ') << "年龄";		
	cout << setiosflags(ios::right) << setw(7) << setfill(' ') << "性别";		
	cout << setiosflags(ios::right) << setw(14) << setfill(' ') << "社会身份";		
	cout << setiosflags(ios::right) << setw(14) << setfill(' ') << "出生日期";		
	cout << setiosflags(ios::right) << setw(12) << setfill(' ') << "职务";		
	cout << setiosflags(ios::right) << setw(10) << setfill(' ')  << "职称";		
	cout << setiosflags(ios::right) << setw(11) << setfill(' ') << "工资";		
	cout << setiosflags(ios::right) << setw(14) << setfill(' ') << "入伍时间" << endl;		
	cout << setiosflags(ios::right) << setw(10) << setfill(' ') << name;		
	cout << setiosflags(ios::right) << setw(7) << setfill(' ') << number;		
	cout << setiosflags(ios::right) << setw(7) << setfill(' ') << age;		
	cout << setiosflags(ios::right) << setw(7) << setfill(' ') << sex;		
	cout << setiosflags(ios::right) << setw(14) << setfill(' ') << party_mem;		
	cout << setiosflags(ios::right) << setw(14) << setfill(' ') << birthday;		
	cout << setiosflags(ios::right) << setw(12) << setfill(' ') << teach;		
	cout << setiosflags(ios::right) << setw(10) << setfill(' ') << Job_title;		
	cout << setiosflags(ios::right) << setw(11) << setfill(' ')  << te_salary;		
	cout << setiosflags(ios::right) << setw(14) << setfill(' ')  << te_joining_time << endl;	}	
	else if (AT_joining_time != 0)
		{		
		cout << setiosflags(ios::right) << setw(10) << setfill(' ') << "姓名";		
		cout << setiosflags(ios::right) << setw(7) << setfill(' ') << "工号";		
		cout << setiosflags(ios::right) << setw(7) << setfill(' ') << "年龄";		
		cout << setiosflags(ios::right) << setw(7) << setfill(' ') << "性别";		
		cout << setiosflags(ios::right) << setw(14) << setfill(' ') << "社会身份";		
		cout << setiosflags(ios::right) << setw(14) << setfill(' ') << "出生日期";		
		cout << setiosflags(ios::right) << setw(12) << setfill(' ') << "职务";		
		cout << setiosflags(ios::right) << setw(11) << setfill(' ') << "教职工资";		
		cout << setiosflags(ios::right) << setw(10) << setfill(' ') << "行政补贴";		
		cout << setiosflags(ios::right) << setw(11) << setfill(' ') << "总工资";	   
		 cout << setiosflags(ios::right) << setw(13) << setfill(' ') << "入伍时间" << endl;		
		 cout << setiosflags(ios::right) << setw(10) << setfill(' ') << name;		
		 cout << setiosflags(ios::right) << setw(7) << setfill(' ') << number;		
		 cout << setiosflags(ios::right) << setw(7) << setfill(' ') << age;		
		 cout << setiosflags(ios::right) << setw(7) << setfill(' ') << sex;		
		 cout << setiosflags(ios::right) << setw(14) << setfill(' ') << party_mem;		
		 cout << setiosflags(ios::right) << setw(14) << setfill(' ') << birthday;		
		 cout << setiosflags(ios::right) << setw(14) << setfill(' ') << ad_te;		
		 cout << setiosflags(ios::right) << setw(9) << setfill(' ') << te_salary;		
		 cout << setiosflags(ios::right) << setw(9) << setfill(' ') << ad_subsidy;		
		 cout << setiosflags(ios::right) << setw(11) << setfill(' ') << salary;		
		 cout << setiosflags(ios::right) << setw(14) << setfill(' ') << AT_joining_time << endl;	}	
		 else 	
		 {		
		 MessageBeep(MB_ICONERROR);		
		 cout << "未知错误"<< endl;		
		 system("pause");		
		 system("cls");	
		 }	
		 return "";
		 }
	                                    
//显示所有功能
	void Function::Show()
	{	
	system("cls");	
	bool bo = imap.empty();	
	if (bo == true)	
	{		
	MessageBeep(MB_ICONERROR);		
	cout << "请先录入" << endl;		
	system("pause");		
	return;	
	}	
	cout << setiosflags(ios::right) << setw(12) << setfill(' ') << "职务";	
	cout << setiosflags(ios::right) << setw(10) << setfill(' ') << "姓名";	
	cout << setiosflags(ios::right) << setw(9) << setfill(' ') << "年龄";	
	cout << setiosflags(ios::right) << setw(14) << setfill(' ') << "出生日期";	
	cout << setiosflags(ios::right) << setw(7) << setfill(' ') << "工号";	
	cout << setiosflags(ios::right) << setw(7) << setfill(' ') << "性别";	
	cout << setiosflags(ios::right) << setw(14) << setfill(' ') << "社会身份";	
	cout << setiosflags(ios::right) << setw(12) << setfill(' ') << "教师职规";	
	cout << setiosflags(ios::right) << setw(9) << setfill(' ') << "工资";	
	cout << setiosflags(ios::right) << setw(10) << setfill(' ') << "行政补贴";	
	cout << setiosflags(ios::right) << setw(12) << setfill(' ') << "入伍时间" << endl;	
	for (it = imap.begin(); it != imap.end(); it++)	
	{		
	if ((*it).second.find_ad_joining_time() != 0)cout << setiosflags(ios::right) << setw(14) << setfill(' ') << "行政人员";		
	else if ((*it).second.find_te_joining_time() != 0)cout << setiosflags(ios::right) << setw(14) << setfill(' ') << "教职人员";		
	else if ((*it).second.find_AT_joining_time() != 0)	cout << setiosflags(ios::right) << setw(14) << setfill(' ') << "教职行政";		
	cout << setiosflags(ios::right) << setw(10) << setfill(' ') << (*it).second.find_name();		
	cout << setiosflags(ios::right) << setw(7) << setfill(' ') << (*it).second.find_age();		
	cout << setiosflags(ios::right) << setw(14) << setfill(' ') << (*it).second.find_birthday();		
	cout << setiosflags(ios::right) << setw(7) << setfill(' ') << (*it).second.find_num();		
	int t = (*it).second.find_sex();		
	if(t==1)	cout << setiosflags(ios::right) << setw(7) << setfill(' ') <<"男";		
	else if(t==2)cout << setiosflags(ios::right) << setw(7) << setfill(' ') << "女";		
	int t1 = (*it).second.find_party_mem();		
	if(t1==1)cout << setiosflags(ios::right) << setw(14) << setfill(' ') <<"党员";		
	if (t1 == 2)cout << setiosflags(ios::right) << setw(14) << setfill(' ') << "非党员";		
	if ((*it).second.find_ad_joining_time() !=0)		
	{			
	cout << setiosflags(ios::right) << setw(9) << setfill(' ') <<"无";			
	cout << setiosflags(ios::right) << setw(10) << setfill(' ') << (*it).second.find_ad_salary();			
cout << setiosflags(ios::right) << setw(9) << setfill(' ') << (*it).second.find_ad_subsidy();			cout << setiosflags(ios::right) << setw(14) << setfill(' ') << (*it).second.find_ad_joining_time()<< endl;		
}		
else if ((*it).second.find_te_joining_time()!= 0)		
{			
cout << setiosflags(ios::right) << setw(10) << setfill(' ') << (*it).second.find_Job_title();			cout << setiosflags(ios::right) << setw(10) << setfill(' ') << (*it).second.find_te_salary();			cout << setiosflags(ios::right) << setw(9) << setfill(' ') << "无";			
cout << setiosflags(ios::right) << setw(14) << setfill(' ') << (*it).second.find_te_joining_time() << endl;		
}		
else if ((*it).second.find_AT_joining_time() != 0)		
{			
cout << setiosflags(ios::right) << setw(10) << setfill(' ') << (*it).second.find_Job_title();			cout << setiosflags(ios::right) << setw(10) << setfill(' ') << (*it).second.find_salary();			cout << setiosflags(ios::right) << setw(9) << setfill(' ') << (*it).second.find_ad_subsidy();			cout << setiosflags(ios::right) << setw(14) << setfill(' ') << (*it).second.find_AT_joining_time() << endl;		
	}	
	}	
	cout << endl;	
	system("pause");
}                                    
 //删除所有功能
	
void Function::Del_all()
{	
bool bo = imap.empty();
if (bo == true)	
{		
MessageBeep(MB_ICONERROR);		
cout << "请先录入" << endl;		
system("pause");		
system("cls");		
return;	
}		
for (it = imap.begin(); it != imap.end();)	
{		
if ((*it).second.find_age())imap.erase(it++); //预先缓存it,让其顺利++		
else break;	
}	
//for (it = imap.begin(); it != imap.end(); it++)	
//imap.erase(it);	
//imap.clear();	
cout << "<信息已全部删除>" << endl;	
system("pause");
}
// 主函数
int main()
{	
PlaySound(TEXT("D:\\Otokaze - Save The Flavor.wav"), NULL, SND_FILENAME | SND_ASYNC);	system("color f5");	
cout << "Enter in->";	
MessageBeep(MB_OK);	
getline(cin, warning_eat);	
system("cls");	
cout << "是否从硬盘文件读入数据" << endl << endl;	
cout << "1-<是的,我要从文件读入>" << endl;	
cout << "2-<不是,我要创建新的文件>" << endl;	
cout << endl << "输入区:";	
int enter_way;	
cin >> enter_way;	
system("cls");	
if (enter_way == 1)	
{		
MessageBeep(MB_OK);		
string m;		
ifstream input_txt;		
Ad_Te_staff obj("", 0, 0, 0, 0, 0, 0, 0, "", 0, 0, 0, 1, 1, 0, 0, "", 0, 0, 0, 1, 1, 0);		input_txt >> obj;		
system("cls");		
cout << "<读入成功>" << endl;		
system("pause");		
Function a;		
a.Home();	
}	
else if (enter_way == 2)	
{		
Function a;		
a.Home();	
}	
else	{		
MessageBeep(MB_ICONERROR);		
cout << "无法识别此操作" << endl;		
system("pause");		
main();	
}
}
  • 5
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

莉妮可丝的猫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值