1、问题描述

某高校有四类员工:教师、实验员、行政人员,教师兼行政人员;共有的信息包括:编号、姓名、性别、年龄等。其中,教师还包含的信息有:所在系部、专业、职称;实验员还包含的信息由:所在实验室、职务;行政人员还包含的信息有:政治面貌、职称等。

2、功能要求

(1)添加功能:程序能够任意添加上述四类人员的记录,可提供选择界面供用户选择所要添加的人员类别,要求员工的编号要唯一,如果添加了重复编号的记录时,则提示数据添加重复并取消添加。

(2)查询功能:可根据编号信息对已添加的记录进行查询,如果未找到,给出相应的提示信息,如果找到,则显示相应的记录信息。

(3)显示功能:可显示当前系统中所有记录,每条记录占据一行。

(4)编辑功能:可根据查询结果对相应的记录进行修改,修改时注意编号的唯一性。

(5)删除功能:主要实现对已添加的人员记录进行删除。如果当前系统中没有相应的人员记录,则提示“记录为空!”并返回操作;否则,输入要删除的人员的编号或姓名,根据所输入的信息删除该人员记录,如果没有找到该人员信息,则提示相应的记录不存。

(6)统计功能:能根据多种参数进行人员的统计。能统计四类人员数及人员总数。

(7) 保存功能:可将当前系统中各类人员记录存入文件中,存入方式任意。

(8)读取功能:可将保存在文件中的人员信息读入到当前系统中,供用户进行使用。


//main.cpp
#include "teacher.h"
#include "tea.h"
#include "test.h"
#include "po.h"
#include "tea_po.h"
//教师管理界面
void tea1(tea TEA)
{int b,v=TeaTop;do{cout<<"教师管理界面"<<endl;cout<<"==========================================================="<<endl;cout<<"||                                                       ||"<<endl;cout<<"||           1.添加        2.查询        3.显示          ||"<<endl;cout<<"||                                                       ||"<<endl;cout<<"||           4.编辑        5.删除        6.统计          ||"<<endl;cout<<"||                                                       ||"<<endl;cout<<"||           7.保存        8.读取        0.退出          ||"<<endl;cout<<"||                                                       ||"<<endl;cout<<"==========================================================="<<endl;cout<<"请选择:";cin>>b;//用户的管理界面接口switch(b){case 1:TEA.Add(v);system("pause");break;//添加case 2:TEA.Search();system("pause");break;//查询case 3:TEA.Show();system("pause");break;//显示case 4:TEA.Edit();system("pause");break;//编辑case 5:TEA.Delete(v);system("pause");break;//删除case 6:cout<<"共有教师人数:"<<v<<endl;system("pause");break;//统计case 7:TEA.Save();system("pause");break;//保存case 8:TEA.Read(v);system("pause");break;//读取default:cout<<"\n 错误!"<<endl;system("pause");break;case 0:break;//退出}system("cls");}while(b!=0);
}
//实验员管理界面
void test1(test TES)
{int b,v=Testop;do{cout<<"实验员管理界面"<<endl;cout<<"==========================================================="<<endl;cout<<"||                                                       ||"<<endl;cout<<"||           1.添加        2.查询        3.显示          ||"<<endl;cout<<"||                                                       ||"<<endl;cout<<"||           4.编辑        5.删除        6.统计          ||"<<endl;cout<<"||                                                       ||"<<endl;cout<<"||           7.保存        8.读取        0.退出          ||"<<endl;cout<<"||                                                       ||"<<endl;cout<<"==========================================================="<<endl;cout<<"请选择:";cin>>b;switch(b){case 1:TES.Add(v);system("pause");break;case 2:TES.Search();system("pause");break;case 3:TES.Show();system("pause");break;case 4:TES.Edit();system("pause");break;case 5:TES.Delete(v);system("pause");break;case 6:cout<<"共有实验员人数:"<<v<<endl;system("pause");break;case 7:TES.Save();system("pause");break;case 8:TES.Read(v);system("pause");break;default:cout<<"\n错误!"<<endl;system("pause");break;case 0:break;}cout<<"按回车键返回"<<endl;system("cls");}while(b!=0);
}
//行政人员管理界面
void po1(po PO)
{int b,v=PolicerTop;do{cout<<"行政人员管理界面"<<endl;cout<<"==========================================================="<<endl;cout<<"||                                                       ||"<<endl;cout<<"||           1.添加        2.查询        3.显示          ||"<<endl;cout<<"||                                                       ||"<<endl;cout<<"||           4.编辑        5.删除        6.统计          ||"<<endl;cout<<"||                                                       ||"<<endl;cout<<"||           7.保存        8.读取        0.退出          ||"<<endl;cout<<"||                                                       ||"<<endl;cout<<"==========================================================="<<endl;cout<<"请选择:";cin>>b;switch(b){case 1:PO.Add(v);system("pause");break;case 2:PO.Search();system("pause");break;case 3:PO.Show();system("pause");break;case 4:PO.Edit();system("pause");break;case 5:PO.Delete(v);system("pause");break;case 6:cout<<"共有行政员人数:"<<v<<endl;system("pause");break;case 7:PO.Save();system("pause");break;case 8:PO.Read(v);system("pause");break;default:cout<<"\n 错误!"<<endl;system("pause");break;case 0:break;}system("cls");}while(b!=0);
}//教师兼行政人员管理界面
void tea_po1(tea_po TEA_PO)
{int b,v=Tea_PolicerTop;do{cout<<"教师兼行政人员管理界面"<<endl;cout<<"==========================================================="<<endl;cout<<"||                                                       ||"<<endl;cout<<"||           1.添加        2.查询        3.显示          ||"<<endl;cout<<"||                                                       ||"<<endl;cout<<"||           4.编辑        5.删除        6.统计          ||"<<endl;cout<<"||                                                       ||"<<endl;cout<<"||           7.保存        8.读取        0.退出          ||"<<endl;cout<<"||                                                       ||"<<endl;cout<<"==========================================================="<<endl;cout<<"请选择:";cin>>b;switch(b){case 1:TEA_PO.Add(v);system("pause");break;case 2:TEA_PO.Search();system("pause");break;case 3:TEA_PO.Show();system("pause");break;case 4:TEA_PO.Edit();system("pause");break;case 5:TEA_PO.Delete(v);system("pause");break;case 6:cout<<"共有教师兼行政员人数:"<<v<<endl;system("pause");break;case 7:TEA_PO.Save();system("pause");break;case 8:TEA_PO.Read(v);system("pause");break;default:cout<<"\n 错误!"<<endl;system("pause");break;case 0:break;}system("cls");}while(b!=0);
}//密码登录界面void loading()
{int stuNum=0;int lock=0;int *temp1=&stuNum;//指针取得用户输入的学号密码int *temp2=&lock;cout<<"    *****************************************"<<endl;cout<<"    **                                     **"<<endl;cout<<"    **    欢迎来到高校人员信息管理系统     **"<<endl;cout<<"    **                                     **"<<endl;cout<<"    *****************************************"<<endl;cout<<"                请输入学工号:";cin>>stuNum;cout<<"                请输入密码:";cin>>lock;if(*temp1!=*temp2){cout<<"密码错误!请重新输入"<<endl;system("pause");system("cls");loading();//函数的递归使用,输入密码不正确,就再次使用函数进行登录}
}
//主函数
int main()
{   tea tea2;test tes2;po po2;tea_po tea_po2;int choice;int *choi=&choice;//指针传递loading();//先登录system("cls");while(true){system("cls");cout<<endl;cout<<"************欢迎使用高校人员信息管理系统************"<<endl;cout<<" __________________________________________________"<<endl;cout<<"|                                                  |"<<endl;cout<<"|                                                  |"<<endl;cout<<"|                                                  |"<<endl;cout<<"|                   1.教师管理                     |"<<endl;cout<<"|                   2.实验员管理                   |"<<endl;cout<<"|                   3.行政员管理                   |"<<endl;cout<<"|                   4.教师兼行政员管理             |"<<endl;cout<<"|                   0.退出                         |"<<endl;cout<<"|                                                  |"<<endl;cout<<"|                                                  |"<<endl;cout<<"|__________________________________________________|"<<endl;cout<<"请选择:";cin>>choice;switch(*choi){case 1:system("cls");tea1(tea2);break;case 2:system("cls");test1(tes2);break;case 3:system("cls");po1(po2);break;case 4:system("cls");tea_po1(tea_po2);break;case 0:system("cls");cout<<"                欢迎您下次登录!"<<endl;cout<<"                欢迎您下次登录!"<<endl;cout<<"                欢迎您下次登录!"<<endl;loading();break;default:cout<<"\n 错误!"<<endl;system("pause");break;}}return 0;}

persion.h

#ifndef PERSION_H_INCLUDED
#define PERSION_H_INCLUDED
#include<fstream>
#include<iostream>
#include<string>
using namespace std;
static int TeaTop;//静态全局变量,教师人员上限
static int Testop;//静态全局变量,实验员上限
static int PolicerTop;//静态全局变量,行政人员上限
static int Tea_PolicerTop;//静态全局变量,教师兼行政人员上限
#define z 1000
class person
{
friend class teacher;//声明友元,教师类访问人员类私有变量
friend class tester;//声明友元,实验人员类访问人员类私有变量
friend class policer;//声明友元,行政人员类访问人员类私有变量public:int num;string name;string sex;int age;
};#endif // PERSION_H_INCLUDED

teacher.h

#ifndef TEACHER_H_INCLUDED
#define TEACHER_H_INCLUDED
#include "persion.h"
class teacher :virtual public person//教师类
{
friend class teacher_policer;//声明友元,教师兼行政人员类访问教师私有变量
public:string dept;string special;string title;void Input(){cout<<"请再次输入编号以确定:";cin>>num;cout<<"请输入姓名:";cin>>name;cout<<"请输入性别:";cin>>sex;cout<<"请输入年龄:";cin>>age;cout<<"请输入该教师所在系别:";cin>>dept;cout<<"请输入该教师专业:";cin>>special;cout<<"请输入该教师的职称:";cin>>title;}void Output(){cout<<"编号: "<<num<<"  "<<"姓名: "<<name<<"  "<<"性别: "<<sex<<"  "<<"年龄: "<<age<<"  "<<"所在系: "<<dept<<"  "<<"专业: "<<special<<"  "<<"职称: "<<title<<endl;}
};#endif // TEACHER_H_INCLUDED

tea.h

#ifndef TEA_H_INCLUDED
#define TEA_H_INCLUDED
#include "teacher.h"class tea//方法类
{
public:teacher Tea[z];int Add(int &w);int Search();void Show();void Edit();int Delete(int &w);void Save();int Read(int &w);tea(void);~tea(void);
};#endif // TEA_H_INCLUDED

tea.cpp

#include "tea.h"
int tea::Add(int &w)//添加
{teacher t;int i,nu;if(TeaTop==z)//教师最大人数达到宏定义的最大值{cout<<"人数已满"<<endl;return 0;}cout<<"请输入编号:";cin>>nu;for(i=0;i<TeaTop;i++){if(nu==Tea[i].num){cout<<"已有编号,请重新输入"<<endl;return 0;}}t.Input();Tea[TeaTop]=t;TeaTop++;w=TeaTop;cout<<"添加成功!"<<endl;return 1;
}
int tea::Search()//查询
{int j,n;cout<<"请输入编号:";cin>>n;for(j=0;j<TeaTop;j++){if(n==Tea[j].num)break;}if(j==TeaTop)cout<<"没有此人!"<<endl;elseTea[j].Output();//输出return 1;
}
void tea::Show()//显示
{int i;if(TeaTop==0){cout<<"记录为空!"<<endl;return;}for(i=0;i<TeaTop;i++)Tea[i].Output();
}
void tea::Edit()//编辑
{teacher t1;int j,n;cout<<"请输入要编辑的人的编号:";cin>>n;for(j=0;j<TeaTop;j++){if(n==Tea[j].num)break;}if(j==TeaTop){cout<<"没有此人!"<<endl;return;}cout<<"输入修改后的信息,编号不能改:"<<endl;t1.Input();Tea[j]=t1;cout<<"编辑成功!"<<endl;
}
int tea::Delete(int &w)//删除
{int j,n;cout<<"请输入要删除的人的编号:";cin>>n;for(j=0;j<TeaTop;j++){if(n==Tea[j].num)break;}if(j==TeaTop){cout<<"记录为空!"<<endl;return 0;}for(j;j<TeaTop;j++){Tea[j]=Tea[j+1];}TeaTop--;w=TeaTop;//删除后人数减一cout<<"删除成功!"<<endl;return 1;
}
void tea::Save()
{int i;ofstream outfile,outfile1;outfile1.open("TeaTop.dat",ios::out);outfile1<<TeaTop;outfile.open("Tea_data.dat",ios::out);if(!outfile){cerr<<"没有此文件!"<<endl;return;}for(i=0;i<TeaTop;i++){outfile<<Tea[i].num<<endl;outfile<<Tea[i].name<<endl;outfile<<Tea[i].sex<<endl;outfile<<Tea[i].age<<endl;outfile<<Tea[i].dept<<endl;outfile<<Tea[i].special<<endl;outfile<<Tea[i].title<<endl;}outfile.close();cout<<"保存成功!"<<endl;
}
int tea::Read(int &w)
{w=0;int i;ifstream infile,infile1;infile1.open("TeaTop.dat",ios::in);infile1>>TeaTop;w=TeaTop;infile.open("Tea_data.dat",ios::in);if(!infile){cerr<<"没有此文件!"<<endl;return 0;}for(i=0;i<TeaTop;i++){infile>>Tea[i].num;infile>>Tea[i].name;infile>>Tea[i].sex;infile>>Tea[i].age;infile>>Tea[i].dept;infile>>Tea[i].special;infile>>Tea[i].title;}infile.close();cout<<"读取成功!"<<endl;return 0;
}tea::tea(void)
{}tea::~tea(void)
{}

tester.h

#ifndef TESTER_H_INCLUDED
#define TESTER_H_INCLUDED
#include "persion.h"
class tester ://实验员类virtual public person
{
public:string testroom;string post;void Input(){cout<<"请再次输入编号以确定:";cin>>num;cout<<"请输入姓名:";cin>>name;cout<<"请输入性别:";cin>>sex;cout<<"请输入年龄:";cin>>age;cout<<"请输入该实验员所在实验室:";cin>>testroom;cout<<"请输入该实验员的职务:";cin>>post;}void Output(){cout<<"编号: "<<num<<"  "<<"姓名: "<<name<<"  "<<"性别: "<<sex<<"  "<<"年龄: "<<age<<"  "<<"所在实验室: "<<testroom<<"  "<<"职务: "<<post<<endl;}};#endif // TESTER_H_INCLUDED

test.h

#ifndef TEST_H_INCLUDED
#define TEST_H_INCLUDED
#include "tester.h"
class test//方法类
{
public:tester Test[z];int Add(int &w);int Search();void Show();void Edit();int Delete(int &w);void Save();int Read(int &w);};#endif // TEST_H_INCLUDED

test.cpp

#include "test.h"
int test::Add(int &w)
{tester t;int i,nu;if(Testop==z){cout<<"人数已满"<<endl;return 0;}cout<<"请输入编号:";cin>>nu;for(i=0;i<Testop;i++){if(nu==Test[i].num){cout<<"已有编号,请重新输入"<<endl;return 0;}}t.Input();Test[Testop]=t;Testop++;w=Testop;cout<<"添加成功!"<<endl;return 1;
}
int test::Search()
{int j,n;cout<<"请输入编号:";cin>>n;for(j=0;j<Testop;j++){if(n==Test[j].num)break;}if(j==Testop)cout<<"没有此人!"<<endl;elseTest[j].Output();return 1;
}
void test::Show()
{int i;if(Testop==0){cout<<"记录为空!"<<endl;return;}for(i=0;i<Testop;i++)Test[i].Output();
}
void test::Edit()
{tester t1;int j,n;cout<<"请输入要编辑的人的编号:";cin>>n;for(j=0;j<Testop;j++){if(n==Test[j].num) break;}if(j==Testop){cout<<"没有此人!"<<endl;return;}cout<<"输入修改后的信息,编号不能改:"<<endl;t1.Input();Test[j]=t1;cout<<"编辑成功!"<<endl;
}
int test::Delete(int &w)
{int j,n;cout<<"请输入要删除的人的编号:";cin>>n;for(j=0;j<Testop;j++){if(n==Test[j].num)break;}if(j==Testop){cout<<"记录为空!"<<endl;return 0;}for(j;j<Testop;j++){Test[j]=Test[j+1];}Testop--;w=Testop;cout<<"删除成功!"<<endl;return 1;
}
void test::Save()
{int i;ofstream outfile,outfile1;outfile1.open("Test.dat",ios::out);outfile1<<Testop;outfile.open("Test_data.dat",ios::out);if(!outfile){cerr<<"没有此文件!"<<endl;return;}for(i=0;i<Testop;i++){outfile<<Test[i].num<<endl;outfile<<Test[i].name<<endl;outfile<<Test[i].sex<<endl;outfile<<Test[i].age<<endl;outfile<<Test[i].testroom<<endl;outfile<<Test[i].post<<endl;}outfile.close();cout<<"保存成功!"<<endl;
}
int test::Read(int &w)
{int i;ifstream infile,infile1;infile1.open("Test.dat",ios::in);infile1>>Testop;w=Testop;infile.open("Test_data.dat",ios::in);if(!infile){cerr<<"没有此文件!"<<endl;return 1;}for(i=0;i<Testop;i++){infile>>Test[i].num;infile>>Test[i].name;infile>>Test[i].sex;infile>>Test[i].age;infile>>Test[i].testroom;infile>>Test[i].post;}infile.close();cout<<"读取成功!"<<endl;return 0;
}

policer.h

#include "test.h"
int test::Add(int &w)
{tester t;int i,nu;if(Testop==z){cout<<"人数已满"<<endl;return 0;}cout<<"请输入编号:";cin>>nu;for(i=0;i<Testop;i++){if(nu==Test[i].num){cout<<"已有编号,请重新输入"<<endl;return 0;}}t.Input();Test[Testop]=t;Testop++;w=Testop;cout<<"添加成功!"<<endl;return 1;
}
int test::Search()
{int j,n;cout<<"请输入编号:";cin>>n;for(j=0;j<Testop;j++){if(n==Test[j].num)break;}if(j==Testop)cout<<"没有此人!"<<endl;elseTest[j].Output();return 1;
}
void test::Show()
{int i;if(Testop==0){cout<<"记录为空!"<<endl;return;}for(i=0;i<Testop;i++)Test[i].Output();
}
void test::Edit()
{tester t1;int j,n;cout<<"请输入要编辑的人的编号:";cin>>n;for(j=0;j<Testop;j++){if(n==Test[j].num) break;}if(j==Testop){cout<<"没有此人!"<<endl;return;}cout<<"输入修改后的信息,编号不能改:"<<endl;t1.Input();Test[j]=t1;cout<<"编辑成功!"<<endl;
}
int test::Delete(int &w)
{int j,n;cout<<"请输入要删除的人的编号:";cin>>n;for(j=0;j<Testop;j++){if(n==Test[j].num)break;}if(j==Testop){cout<<"记录为空!"<<endl;return 0;}for(j;j<Testop;j++){Test[j]=Test[j+1];}Testop--;w=Testop;cout<<"删除成功!"<<endl;return 1;
}
void test::Save()
{int i;ofstream outfile,outfile1;outfile1.open("Test.dat",ios::out);outfile1<<Testop;outfile.open("Test_data.dat",ios::out);if(!outfile){cerr<<"没有此文件!"<<endl;return;}for(i=0;i<Testop;i++){outfile<<Test[i].num<<endl;outfile<<Test[i].name<<endl;outfile<<Test[i].sex<<endl;outfile<<Test[i].age<<endl;outfile<<Test[i].testroom<<endl;outfile<<Test[i].post<<endl;}outfile.close();cout<<"保存成功!"<<endl;
}
int test::Read(int &w)
{int i;ifstream infile,infile1;infile1.open("Test.dat",ios::in);infile1>>Testop;w=Testop;infile.open("Test_data.dat",ios::in);if(!infile){cerr<<"没有此文件!"<<endl;return 1;}for(i=0;i<Testop;i++){infile>>Test[i].num;infile>>Test[i].name;infile>>Test[i].sex;infile>>Test[i].age;infile>>Test[i].testroom;infile>>Test[i].post;}infile.close();cout<<"读取成功!"<<endl;return 0;
}

po.h

#ifndef PO_H_INCLUDED
#define PO_H_INCLUDED
#include "policer.h"
class po//方法类
{
public:policer Po[z];int Add(int &w);int Search();void Show();void Edit();int Delete(int &w);void Save();int Read(int &w);};#endif // PO_H_INCLUDED

po.cpp

#include "po.h"
int po::Add(int &w)
{policer t;int i,nu;if(PolicerTop==z){cout<<"人数已满"<<endl;return 0;}cout<<"请输入编号:";cin>>nu;for(i=0;i<PolicerTop;i++){if(nu==Po[i].num){cout<<"已有编号,请重新输入"<<endl;return 0;}}t.Input();Po[PolicerTop]=t;PolicerTop++;w=PolicerTop;cout<<"添加成功!"<<endl;return 1;
}
int po::Search()
{int j,n;cout<<"请输入编号:";cin>>n;for(j=0;j<PolicerTop;j++){if(n==Po[j].num)break;}if(j==PolicerTop)cout<<"没有此人!"<<endl;elsePo[j].Output();return 1;
}
void po::Show()
{int i;if(PolicerTop==0){cout<<"记录为空!"<<endl;return;}for(i=0;i<PolicerTop;i++)Po[i].Output();
}
void po::Edit()
{policer t1;int j,n;cout<<"请输入要编辑的人的编号:";cin>>n;for(j=0;j<PolicerTop;j++){if(n==Po[j].num)break;}if(j==PolicerTop){cout<<"没有此人!"<<endl;return;}cout<<"输入修改后的信息,编号不能改:"<<endl;t1.Input();Po[j]=t1;cout<<"编辑成功!"<<endl;
}
int po::Delete(int &w)
{int j,n;cout<<"请输入要删除的人的编号:";cin>>n;for(j=0;j<PolicerTop;j++){if(n==Po[j].num)break;}if(j==PolicerTop){cout<<"记录为空!"<<endl;return 0;}for(j;j<PolicerTop;j++){Po[j]=Po[j+1];}PolicerTop--;w=PolicerTop;cout<<"删除成功!"<<endl;return 1;
}
void po::Save()
{int i;ofstream outfile,outfile1;outfile1.open("PolicerTop.dat",ios::out);outfile1<<PolicerTop;outfile.open("Policers_data.dat",ios::out);if(!outfile){cerr<<"没有此文件!"<<endl;return;}for(i=0;i<PolicerTop;i++){outfile<<Po[i].num<<endl;outfile<<Po[i].name<<endl;outfile<<Po[i].sex<<endl;outfile<<Po[i].age<<endl;outfile<<Po[i].polices<<endl;outfile<<Po[i].title1<<endl;}outfile.close();cout<<"保存成功!"<<endl;
}
int po::Read(int &w)
{w=0;int i;ifstream infile,infile1;infile1.open("PolicerTop.dat",ios::in);infile1>>PolicerTop;w=PolicerTop;infile.open("Policers_data.dat",ios::in);if(!infile){cerr<<"没有此文件!"<<endl;return 1;}for(i=0;i<PolicerTop;i++){infile>>Po[i].num;infile>>Po[i].name;infile>>Po[i].sex;infile>>Po[i].age;infile>>Po[i].polices;infile>>Po[i].title1;}infile.close();cout<<"读取成功!"<<endl;return 0;
}

tea_po.h

#ifndef TEA_PO_H_INCLUDED
#define TEA_PO_H_INCLUDED
#include "teacher_policer.h"
class tea_po//方法类
{
public:teacher_policer Tea_Po[z];int Add(int &w);int Search();void Show();void Edit();int Delete(int &w);void Save();int Read(int &w);};#endif // TEA_PO_H_INCLUDED

teacher_policer.h

#ifndef TEA_PO_H_INCLUDED
#define TEA_PO_H_INCLUDED
#include "teacher_policer.h"
class tea_po//方法类
{
public:teacher_policer Tea_Po[z];int Add(int &w);int Search();void Show();void Edit();int Delete(int &w);void Save();int Read(int &w);};#endif // TEA_PO_H_INCLUDED

tea_po.cpp

#include "tea_po.h"
int tea_po::Add(int &w)
{teacher_policer t;int i,nu;if(Tea_PolicerTop==z){cout<<"人数已满"<<endl;return 0;}cout<<"请输入编号:";cin>>nu;for(i=0;i<Tea_PolicerTop;i++){if(nu==Tea_Po[i].num){cout<<"已有编号,请重新输入"<<endl;return 0;}}t.Input();Tea_Po[Tea_PolicerTop]=t;Tea_PolicerTop++;w=Tea_PolicerTop;cout<<"添加成功!"<<endl;return 1;
}
int tea_po::Search()
{int j,n;cout<<"请输入编号:";cin>>n;for(j=0;j<Tea_PolicerTop;j++){if(n==Tea_Po[j].num)break;}if(j==Tea_PolicerTop)cout<<"没有此人!"<<endl;elseTea_Po[j].Output();return 1;
}
void tea_po::Show()
{int i;if(Tea_PolicerTop==0){cout<<"记录为空!"<<endl;return;}for(i=0;i<Tea_PolicerTop;i++)Tea_Po[i].Output();
}
void tea_po::Edit()
{teacher_policer t1;int j,n;cout<<"请输入要编辑的人的编号:";cin>>n;for(j=0;j<Tea_PolicerTop;j++){if(n==Tea_Po[j].num)break;}if(j==Tea_PolicerTop){cout<<"没有此人!"<<endl;return;}cout<<"输入修改后的信息,编号不能改:"<<endl;t1.Input();Tea_Po[j]=t1;cout<<"编辑成功!"<<endl;
}
int tea_po::Delete(int &w)
{int j,n;cout<<"请输入要删除的人的编号:";cin>>n;for(j=0;j<Tea_PolicerTop;j++){if(n==Tea_Po[j].num)break;}if(j==Tea_PolicerTop){cout<<"记录为空!"<<endl;return 0;}for(j;j<Tea_PolicerTop;j++){Tea_Po[j]=Tea_Po[j+1];}Tea_PolicerTop--;w=Tea_PolicerTop;cout<<"删除成功!"<<endl;return 1;
}
void tea_po::Save()
{int i;ofstream outfile,outfile1;outfile1.open("Tea_PolicerTop.dat",ios::out);outfile1<<Tea_PolicerTop;outfile.open("Tea_Policers_data.dat",ios::out);if(!outfile){cerr<<"没有此文件!"<<endl;return;}for(i=0;i<Tea_PolicerTop;i++){outfile<<Tea_Po[i].num<<endl;outfile<<Tea_Po[i].name<<endl;outfile<<Tea_Po[i].sex<<endl;outfile<<Tea_Po[i].age<<endl;outfile<<Tea_Po[i].polices<<endl;outfile<<Tea_Po[i].title<<endl;outfile<<Tea_Po[i].dept<<endl;outfile<<Tea_Po[i].special<<endl;}outfile.close();cout<<"保存成功!"<<endl;
}
int tea_po::Read(int &w)
{w=0;int i;ifstream infile,infile1;infile1.open("Tea_PolicerTop.dat",ios::in);infile1>>Tea_PolicerTop;w=Tea_PolicerTop;infile.open("Tea_Policers_data.dat",ios::in);if(!infile){cerr<<"没有此文件!"<<endl;return 1;}for(i=0;i<Tea_PolicerTop;i++){infile>>Tea_Po[i].num;infile>>Tea_Po[i].name;infile>>Tea_Po[i].sex;infile>>Tea_Po[i].age;infile>>Tea_Po[i].polices;infile>>Tea_Po[i].title;infile>>Tea_Po[i].dept;infile>>Tea_Po[i].special;}infile.close();cout<<"读取成功!"<<endl;return 0;
}

代码参考了前辈们的,感谢前辈的示范!希望能帮到大家。

/*一款程序是否具有界面的友好性,就要看运行后各个界面给用户提供的提示以及页面跳转的机制,我在制作登录界面时,我的想法是,登录时输入账号密码,正确就成功进入系统,但是不成功的话,要返回登录界面。

开始时,我想了想,这个功能可以用goto语句,但是goto语句风险大,我便想通过程序控制语句完成,最开始编写的程序是可以回到登录界面,但是是登录界面的叠加,于是进一步改进,利用清屏语句,又使得我的程序密码机制失效,不管怎样输入都不可以进入系统。我又采用了do...while语句,先执行一次,后面操作看条件,可惜还是效果不佳。

我开始分析,我发现这种情况与函数的递归调用很相似,我急忙用判断语句和函数的递归结合,运行起来达到了我的预期效果!

虽然登录页面知识系统的一部分,但是可以说是程序员与用户的沟通桥梁,不经意之间用缺乏实践的递归进入我的代码,是我的最得意,最开心的地方,也是我的一点创意!*/(哈哈哈这是课程设计报告里的话)

谢谢大家看到这里!

高校人员信息管理系统设计相关推荐

  1. 基于ssm的高校校友信息管理系统设计与实现-计算机毕业设计

    摘 要 随着信息技术的发展,带动了各种管理系统和应用软件的产生,其中高校校友信息管理系统就是其中之一.每一个人都会经历过小学.中学.大学的学习过程,班级同学也越来越多,但是毕业后大家都忙于学习或者工作 ...

  2. 高校社团管理系统java_高校社团管理系统设计及实现.doc

    高校社团管理系统设计及实现 高校社团管理系统设计及实现 摘 要:根据对高校社团管理工作的考核评估,发现高校社团管理不够完善,根据需要,该项目采取了SQL Sever 2008系统以及Java语言分别将 ...

  3. java计算机毕业设计个人连锁民宿信息管理系统设计与开发系统(修改)源码+mysql数据库+系统+lw文档+部署

    java计算机毕业设计个人连锁民宿信息管理系统设计与开发系统(修改)源码+mysql数据库+系统+lw文档+部署 java计算机毕业设计个人连锁民宿信息管理系统设计与开发系统(修改)源码+mysql数 ...

  4. 毕业设计之 --- 基于jsp的高校网上订餐系统设计与实现

    文章目录 0 前言 1 课题简介 2 实现功能 2.1 系统整体设计 3 运行效果 4 部分实现代码 3 整体项目内容 最后 0 前言 今天向大家展示学长帮助同学完成的一个毕业设计:基于jsp的高校网 ...

  5. 就业信息管理系统设计与实现

    就业信息管理系统设计与实现 本系统带程序说明书   有需要的可以去我上传的资源里面找,找不到的话,评论我,或者站内私信留下邮箱, 我给你发,也可以主动联系我博客名字. 因为最近太忙一直没有上传完.em ...

  6. java毕业设计——基于JSP+sqlserver的学生信息管理系统设计与实现(毕业论文+程序源码)——学生信息管理系统

    基于JSP+sqlserver的学生信息管理系统设计与实现(毕业论文+程序源码) 大家好,今天给大家介绍基于JSP+sqlserver的学生信息管理系统设计与实现,文章末尾附有本毕业设计的论文和源码下 ...

  7. SSM+Mysql高校知识共享系统设计与实现

    本科学生毕业设计 高校知识共享系统设计与实现 院系名称:计算机科学与技术学院 专业班级: 学生姓名: 指导教师: 职    称: 摘 要 信息化社会内需要与之针对性的信息获取途径,但是途径的扩展基本上 ...

  8. 基于java的信息管理系统设计与开发

    1 引 言 1 1.1背景及意义 1 1.2 国内外研究概况 1 1.3 研究的内容 2 2 相关技术 3 2.1开发技术 3 2.2 Java简介 3 2.3 MVVM模式 3 2.4 B/S结构 ...

  9. 【java毕业设计】基于javaEE+ssh+jsp+MySqL的大学生就业信息管理系统设计与实现(毕业论文+程序源码)——大学生就业信息管理系统

    基于javaEE+ssh+jsp+MySqL的大学生就业信息管理系统设计与实现(毕业论文+程序源码) 大家好,今天给大家介绍基于javaEE+ssh+jsp+MySqL的大学生就业信息管理系统设计与实 ...

最新文章

  1. 程序员的生活就是这么朴实无华,且没钱
  2. 2018.3.6 11周1次课
  3. 数学奥赛用不用计算机,报考自招必看!五大学科竞赛利弊详解,到底哪科最适合你?...
  4. 唐骏《我的成功也可以复制》1,盖婚房
  5. 怎样为ubuntu eclipse 添加 GBK字符集
  6. springboot_通过Actuator了解应用程序运行时的内部状况
  7. 【GoLang】golang 最佳实践汇总
  8. 扩展KMP模板(学习)
  9. 盘点物联网网络和设备安全的五个误解
  10. Workstation-CentOS-XShell-YUM源 JAVA大数据Week5-DAY1-linux
  11. Dockerfile制作自定义镜像
  12. 前端调试,模拟数据利器之Mock Server使用教程来啦~
  13. 用photoshop将图片不失真的放大
  14. c语言实验报告(四) 从键盘输入字符串a和字符串b,并在a串中的最小元素(不含结束符)后面插入字符串b....
  15. 使用jQuery填充tbody时,填充了两倍数据
  16. 百度糯米用大数据重塑O2O产业
  17. VBA-Excel中单元格的引用方法
  18. 内容推荐场景中自监督学习的应用
  19. 【IoT】内容运营 | 获得更多评论的 8 种策略
  20. C#关键字扫盲——Sealed 密封

热门文章

  1. 二叉树层序遍历 c语言,C语言按层次遍历二叉树算法
  2. 小程序下拉刷新 以及loading颜色
  3. 车间调度的具体分类类型
  4. 读《研发与创新》完,我领悟了... ...
  5. python搭建沙箱环境
  6. #Arduino智能遥控车#
  7. CentOS 7 主机名bogon解决办法
  8. JS的生成器详细使用、生成器结合迭代器使用
  9. java中定义一个数组,获取数组中的最大值和最小值
  10. xposed一些原理总结