高校人员信息管理系统(C++课设)

/*
高校人员信息管理系统
作者:徐世兴
时间:2019年11月1日
*/

//预定义区
#include<iostream>
#include<string>
#include<iomanip>
#include<fstream>
using namespace std;
#include<time.h>
#include <windows.h>
#include<conio.h>
#pragma comment(lib, "Winmm.lib")





//类区
class Person{                            //声明Person类作为基类
protected:
	string number; 
	string name;
	string sex;
	string age;
public:
	Person(){}  //默认构造函数
	Person(string num,string na,string se,string ag)    //带参数的构造函数
	{
		number=num;name=na;sex=se;age=ag;
	}
	void point()//定义显示函数
	{
	 cout.setf(ios::left);//设置格式为左对齐
	 cout<<setw(12)<<number;
	 cout<<setw(8)<<name;
	 cout<<setw(5)<<sex;
	 cout<<setw(8)<<age;
	}
};

class Teacher:public Person{    //共有派生教师类
private:
	string xi_bu;
	string zhuan_ye;
	string zhi_cheng;
public:
	Teacher *next;	
	Teacher(){}  //默认构造函数
	Teacher(string num,string na,string se,string ag,string xi,string zhuan,string zhi):Person(num,na,se,ag) //带参构造函数
	{
		xi_bu=xi;zhuan_ye=zhuan;zhi_cheng=zhi;
	}
	void point()
	{
		Person::point();
		cout.setf(ios::left);//设置格式为左对齐
		cout<<setw(20)<<xi_bu;
	    cout<<setw(20)<<zhuan_ye;
	    cout<<setw(8)<<zhi_cheng<<endl;
	}
	friend void teacheradd();  //声明添加函数为友元函数
	friend int yn(string);//声明判断是否编号已存在
	friend void search();//声明查找函数
	friend void bain_ji(Teacher&);//声明编辑函数
	friend void teacher_tong_ji();//声明统计函数
	friend int rencount();//统计总人数
	friend void teacherSave();//保存信息到文件
	friend int jdadd(Teacher *p1);//将节点加入链表
	friend void delall();//清空
};

class xingzheng:public Person{
private:
	string bumen;
	string zhengzhi;
	string zhicheng;
public:
	xingzheng(){}
	xingzheng *next;
	xingzheng(string num,string na,string se,string ag,string bu,string zz,string zhi):Person(num,na,se,ag)
	{
	bumen=bu;zhengzhi=zz;zhicheng=zhi;
	}
	void point(){
		Person::point();
		cout.setf(ios::left);//设置格式为左对齐
		cout<<setw(20)<<bumen;
	    cout<<setw(20)<<zhengzhi;
	    cout<<setw(8)<<zhicheng<<endl;
	}
	friend void xzadd();  //声明添加函数为友元函数
	friend int xzyn(string);//声明判断是否编号已存在
	friend void xzsearch();//声明查找函数
	friend void xzbain_ji(xingzheng&);//声明编辑函数
	friend void xz_tong_ji();//声明统计函数
	friend int xzrencount();//统计总人数
	friend void xzSave();//保存信息到文件
	friend int xzjdadd(xingzheng *p1);//将节点加入链表
	friend void xzdelall();//清空
};


class shiyan:public Person{//实验员类
private:
	string shiyanshi;
	string zhiwu;
public:
	shiyan *next;
	shiyan(){}//默认构造
	shiyan(string num,string na,string se,string ag,string sy,string zw):Person(num,na,se,ag)
	{shiyanshi=sy;zhiwu=zw;}//带参构造
	void point()
	{
		Person::point();
		cout.setf(ios::left);//设置格式为左对齐
		cout<<setw(30)<<shiyanshi;
	    cout<<setw(8)<<zhiwu<<endl;
	}
	friend void shiyanadd();  //声明添加函数为友元函数
	friend int shiyanjdadd(shiyan *p1);//添加节点
	friend int shiyanyn(string);//声明判断是否编号已存在
	friend void shiyansearch();//声明查找函数
	friend void shiyanbain_ji(shiyan&);//声明编辑函数
	friend void shiyan_tong_ji();//声明统计函数
	friend void shiyandelall();//清空
	friend int shiyanrencount();//统计总人数
	friend void shiyanSave();//保存信息到文件
};

//函数定义区/*****************************************************/

Teacher head;//声明教师类的头节点为全局变量
shiyan head1;
xingzheng head2;
void home();//首页
void tuichu();//感谢语
void huanying();//欢迎语
int question(const char *pstr);//获取判断,声明
void music()//播放音乐
{
PlaySound(TEXT("teacher.wav"), NULL, SND_FILENAME | SND_ASYNC | SND_LOOP);
}
void symusic()//播放音乐
{
PlaySound(TEXT("shiyanyuan.wav"), NULL, SND_FILENAME | SND_ASYNC | SND_LOOP);
}
void xzmusic()//播放音乐
{
PlaySound(TEXT("xz.wav"), NULL, SND_FILENAME | SND_ASYNC | SND_LOOP);
}
void offmusic()//关闭音乐
{
PlaySound(NULL, NULL, SND_FILENAME | SND_ASYNC);
}

void putout(Teacher *p)//显示全部的信息
{
	p=p->next;
	int count=0;
	system("cls");//清屏
	if(!p)
	{
		cout<<"信息为空,请先添加信息!\n";
		return;
	}
	void teacher_list();
	teacher_list();
	while(p)
	{
		p->point();
	    count++;
		p=p->next;
	}
	void __();
	__();
	cout<<"共有"<<count<<"条信息。\n";
}
void shiyanputout(shiyan *p)//显示全部的信息
{
	p=p->next;
	int count=0;
	system("cls");//清屏
	if(!p)
	{
		cout<<"信息为空,请先添加信息!\n";
		return;
	}
	void shiyan_list();
	shiyan_list();
	while(p)
	{
		p->point();
	    count++;
		p=p->next;
	}
	void __();
	__();
	cout<<"共有"<<count<<"条信息。\n";
}
void xzputout(xingzheng *p)//显示全部的信息
{
	p=p->next;
	int count=0;
	system("cls");//清屏
	if(!p)
	{
		cout<<"信息为空,请先添加信息!\n";
		return;
	}
	void xingzheng_list();
	xingzheng_list();
	while(p)
	{
		p->point();
	    count++;
		p=p->next;
	}
	void __();
	__();
	cout<<"共有"<<count<<"条信息。\n";
}

char menu()//菜单,获取用户选择
{
	system("cls");

	cout<<"----------------------------教师信息管理系统--------------------------------\n";

	cout<<"\n\t1.清除所有信息        2.显示所有信息        3.添加信息\n";

	cout<<"\t4.查找信息            5.统计                6.保存信息至文件\n";

	cout<<"\t7.退出系统            8.播放背景音乐        9.关闭背景音乐\n";


	cout<<"\n-------------------------------------------------------------------------------\n";
	void dqsj();
	dqsj();
	char choose;
	cout<<"请输入数字1—9\n";
	cin>>choose;
	while(choose<'1'||choose>'9')//判断输入是否正确
	{
		cout<<"输入错误,请重新输入:";cin>>choose;
	}
	return choose;
}

char xzmenu()//菜单,获取用户选择
{
	system("cls");

	cout<<"----------------------------行政人员信息管理系统--------------------------------\n";

	cout<<"\n\t1.清除所有信息        2.显示所有信息        3.添加信息\n";

	cout<<"\t4.查找信息            5.统计                6.保存信息至文件\n";

	cout<<"\t7.退出系统            8.播放背景音乐        9.关闭背景音乐\n";


	cout<<"\n-------------------------------------------------------------------------------\n";
	void dqsj();
	dqsj();
	char choose;
	cout<<"请输入数字1—9\n";
	cin>>choose;
	while(choose<'1'||choose>'9')//判断输入是否正确
	{
		cout<<"输入错误,请重新输入:";cin>>choose;
	}
	return choose;
}
char shiyanmenu()//菜单,获取用户选择
{
	system("cls");

	cout<<"----------------------------实验员信息管理系统--------------------------------\n";

	cout<<"\n\t1.清除所有信息        2.显示所有信息        3.添加信息\n";

	cout<<"\t4.查找信息            5.统计                6.保存信息至文件\n";

	cout<<"\t7.退出系统            8.播放背景音乐        9.关闭背景音乐\n";


	cout<<"\n-------------------------------------------------------------------------------\n";
	void dqsj();
	dqsj();
	char choose;
	cout<<"请输入数字1—9\n";
	cin>>choose;
	while(choose<'1'||choose>'9')//判断输入是否正确
	{
		cout<<"输入错误,请重新输入:";cin>>choose;
	}
	return choose;
}

void teacherfun(char n)//功能实现
{
	while(1)
	{
		switch(n)
		{
		case '1':delall();system("pause");putout(&head);system("pause");teacherfun(menu());break;
		case '2':putout(&head);if(question("是否返回主菜单?")) teacherfun(menu());break;
		case '3':teacheradd();if(!question("是否继续添加?"))teacherfun(menu());break;
		case '4':search();if(!question("是否继查找?"))teacherfun(menu());break;
		case '5':teacher_tong_ji();if(!question("是否继续统计?"))teacherfun(menu());break;
		case '6':teacherSave();system("pause");teacherfun(menu());break;
		case '7':cout<<"1.返回首页	2.退出程序\n请选择:";char t;while(1){cin>>t;if(t=='1'){if(question("你即将离开系统,是否保存信息?"))teacherSave();home();}else if(t=='2'){if(question("你即将离开系统,是否保存信息?"))teacherSave();tuichu();exit(1);}else cout<<"输入错误,请重新输入:\n";}break;
		case '8':if(question("是否播放背景音乐?"))music();teacherfun(menu());break;
		case '9':if(question("是否关闭背景音乐?"))offmusic();teacherfun(menu());break;
		default:break;
		}
	}
}
void xzfun(char n)//功能实现
{
	while(1)
	{
		switch(n)
		{
		case '1':xzdelall();system("pause");xzputout(&head2);system("pause");xzfun(xzmenu());break;
		case '2':xzputout(&head2);if(question("是否返回主菜单?")) xzfun(xzmenu());break;
		case '3':xzadd();if(!question("是否继续添加?"))xzfun(xzmenu());break;
		case '4':xzsearch();if(!question("是否继查找?"))xzfun(xzmenu());break;
		case '5':xz_tong_ji();if(!question("是否继续统计?"))xzfun(xzmenu());break;
		case '6':xzSave();system("pause");xzfun(xzmenu());break;
		case '7':cout<<"1.返回首页	2.退出程序\n请选择:";char t;while(1){cin>>t;if(t=='1'){if(question("你即将离开系统,是否保存信息?"))xzSave();home();}else if(t=='2'){if(question("你即将离开系统,是否保存信息?"))xzSave();tuichu();exit(1);}else cout<<"输入错误,请重新输入:\n";}break;
		case '8':if(question("是否播放背景音乐?"))xzmusic();xzfun(xzmenu());break;
		case '9':if(question("是否关闭背景音乐?"))offmusic();xzfun(xzmenu());break;
		default:break;
		}
	}
}
void shiyanfun(char n)//功能实现
{
	while(1)
	{
		switch(n)
		{
		case '1':shiyandelall();system("pause");shiyanputout(&head1);system("pause");shiyanfun(shiyanmenu());break;
		case '2':shiyanputout(&head1);if(question("是否返回主菜单?")) shiyanfun(shiyanmenu());break;
		case '3':shiyanadd();if(!question("是否继续添加?"))shiyanfun(shiyanmenu());break;
		case '4':shiyansearch();if(!question("是否继查找?"))shiyanfun(shiyanmenu());break;
		case '5':shiyan_tong_ji();if(!question("是否继续统计?"))shiyanfun(shiyanmenu());break;
		case '6':shiyanSave();system("pause");shiyanfun(shiyanmenu());break;
		case '7':cout<<"1.返回首页	2.退出程序\n请选择:";char t;while(1){cin>>t;if(t=='1'){if(question("你即将离开系统,是否保存信息?"))shiyanSave();home();}else if(t=='2'){if(question("你即将离开系统,是否保存信息?"))shiyanSave();tuichu();exit(1);}else cout<<"输入错误,请重新输入:\n";}break;
		case '8':if(question("是否播放背景音乐?"))symusic();shiyanfun(shiyanmenu());break;
		case '9':if(question("是否关闭背景音乐?"))offmusic();shiyanfun(shiyanmenu());break;
		default:break;
		}
	}
}

void dqsj()//显示当前时间
{
	char * wday[] = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
	time_t t;
	struct tm *p;
	t = time(NULL);
	p = gmtime(&t);
	printf("现在时间是:"); 
	printf("%d年%2d月%2d日", (1900+p->tm_year), (1+p->tm_mon), p->tm_mday);
	printf(" %s ", wday[p->tm_wday]);
	printf("%02d:%02d\n", (8+p->tm_hour), p->tm_min);	
	printf("\n-------------------------------------------------------------------------------\n");
}
int question(const char *pstr)//获取判断
{
	char answer;
	printf("%s请选择(y or n):", pstr);
	while(1 != scanf(" %c", &answer) || (answer != 'y' && answer != 'n'))
	{
		printf("输入错误!\n请重新选择(y or n):");
	}
	if('y' == answer)
		return 1;
	else
		return 0;	
}
void teacheradd()  //添加函数
{
	string num,na,se,xi,zhuan,zhi;string ag;
	cout<<"请输入您要添加的教师信息!"<<endl;
	cout<<"编号:";cin>>num;
	while(yn(num))
	{
		cout<<"该编号已存在,请重新输入:\n";
		cin>>num;
	}
	cout<<"姓名:";cin>>na;
	cout<<"性别:";cin>>se;
	while(se!="男"&&se!="女") //判断性别是否规范
	{
		cout<<"输入的性别有误!!!\n请重新输入:";
		cin>>se;
	}
	cout<<"年龄:";cin>>ag;
	cout<<"系部:";cin>>xi;
	cout<<"专业:";cin>>zhuan;
	cout<<"职称:";cin>>zhi;
	Teacher *T=new Teacher(num,na,se,ag,xi,zhuan,zhi);//声明动态存储空间
	jdadd(T);//节点加入链表
}

void teacher_list()//题头显示
{
	cout<<"-------------------------------------------------------------------------------------------------\n";
	cout<<"编号        姓名    性别 年龄    系部                专业                职称  \n";
	cout<<"-------------------------------------------------------------------------------------------------\n";
}
void xingzheng_list()//题头显示
{
	cout<<"-------------------------------------------------------------------------------------------------\n";
	cout<<"编号        姓名    性别 年龄    部门                政治面貌            职称  \n";
	cout<<"-------------------------------------------------------------------------------------------------\n";
}
void shiyan_list()//题头显示
{
	cout<<"-------------------------------------------------------------------------------------------------\n";
	cout<<"编号        姓名    性别 年龄    实验室                        职务  \n";
	cout<<"-------------------------------------------------------------------------------------------------\n";
}

void __()//显示一条横线
{
	cout<<"-------------------------------------------------------------------------------------------------\n";
}


int yn(string num)//判断编号是否已存在
{
	Teacher *p=head.next;
	while(p)
		if(num==p->number)
			return 1;
		else
			p=p->next;
	return 0;
}
void search()//信息查找,可对结果进行编辑
{
	Teacher *p=head.next;
	cout<<"请输入你要查找信息的编号或姓名:\n";
	string nn;
	cin>>nn;
	int i=0;
	Teacher *temp=&head;//用于承接上一个节点,可能要删除第一个数据
	while(p)
	{
		if(nn==p->number||nn==p->name)
		{
			i++;
			teacher_list();
			p->point();
			__();
			bain_ji(*temp);//编辑函数
		}
		temp=p;
		p=p->next;
	}
	if(!i)
		cout<<"您所查找的信息不存在!!!\n";
}

void bain_ji(Teacher &p1)//编辑函数,参数为上一个节点的引用,方便节点的拆分与插入
{
	string a;
	while(1)
	{
		cout<<"您可以对以上信息进行以下操作:\n";
		cout<<"1.修改         2.删除		3.返回主菜单\n您的选择是:";
		cin>>a;
		if(a =="1")
		{
			string se,num;
			cout<<"请输入您要修改信息!"<<endl;
			cout<<"编号:";cin>>num;
			while(yn(num))
			{
				if(num==p1.next->number)//编号也许不是修改内容
					break;
				cout<<"该编号已存在,请重新输入:\n";
				cin>>num;
			}
			p1.next->number=num;
			cout<<"姓名:";cin>>p1.next->name;
			cout<<"性别:";cin>>se;
			while(se!="男"&&se!="女") //判断性别是否规范
			{
				cout<<"输入的性别有误!!!\n请重新输入:";
				cin>>se;
			}
			p1.next->sex=se;
			cout<<"年龄:";cin>>p1.next->age;
			cout<<"系部:";cin>>p1.next->xi_bu;
			cout<<"专业:";cin>>p1.next->zhuan_ye;
			cout<<"职称:";cin>>p1.next->zhi_cheng;
			cout<<"信息修改成功!\n";
			break;
			}
		else if(a=="2")
		{
			if(question("确定要删除该信息吗?"))
			{
				Teacher *t=p1.next->next;
				p1.next=t;
				cout<<"删除成功!\n";
				break;
			}
		}
		else if(a=="3")
			teacherfun(menu());
		else
			cout<<"输入错误!!!\n请重新输入:";
	}
}

void teacher_tong_ji()//定义统计函数
{
	Teacher *p=head.next;
	if(!p)
	{
		cout<<"信息为空!!\n";
		return;
	}
	cout<<"你可以选择的统计方式:1.按性别统计	2.按系部统计	3.按职称统计		4.返回主菜单\n请输入你的选择:";
	string a;
	while(1)
	{
	cin>>a;
	if(a=="1")//先冒泡排序,后统计,并将结果输出,按性别统计
	{
		Teacher *cur,*tail;
		cur=head.next;
		tail=NULL; 
		if(cur==NULL||cur->next==NULL)
			if(!head.next)//防止一个数据的情况
			   return;
		while(cur!=tail)
		{
			while(cur->next!=tail)
			{
				if(cur->sex>cur->next->sex)
				{
					string temp=cur->age;cur->age=cur->next->age;cur->next->age=temp;
					temp=cur->name;cur->name=cur->next->name;cur->next->name=temp;
					temp=cur->number;cur->number=cur->next->number;cur->next->number=temp;
					temp=cur->sex;cur->sex=cur->next->sex;cur->next->sex=temp;
					temp=cur->xi_bu;cur->xi_bu=cur->next->xi_bu;cur->next->xi_bu=temp;
					temp=cur->zhi_cheng;cur->zhi_cheng=cur->next->zhi_cheng;cur->next->zhi_cheng=temp;
					temp=cur->zhuan_ye;cur->zhuan_ye=cur->next->zhuan_ye;cur->next->zhuan_ye=temp;
				}
				cur=cur->next;
			}
			tail=cur;
			cur=head.next;
		}
		int count=0;//计数
		if(p)
		{
			system("cls");//清屏
			teacher_list();
			while(p)
			{
				p->point();
			 count++;
			 if(!p->next)//判断是否为最后一个节点
			 {
				__();
				cout<<p->sex<<"性教师共有"<<count<<"人。\n";
				break;
			 }
			 if(p->sex!=p->next->sex)
			 {
				__();;
				cout<<p->sex<<"性教师共有"<<count<<"人。\n";
				count=0;cout<<endl<<endl;
				teacher_list();
			 }
			 p=p->next;
			}
		}
		else
			cout<<"信息为空!!!\n";
		break;
	}
	else if(a=="2")//按系部统计
	{
		Teacher *cur,*tail;
		cur=head.next;
		tail=NULL; 
		if(cur==NULL||cur->next==NULL)
			if(!head.next)//防止一个数据的情况
			   return;
		while(cur!=tail)
		{
			while(cur->next!=tail)
			{
				if(cur->xi_bu>cur->next->xi_bu)
				{
					string temp=cur->age;cur->age=cur->next->age;cur->next->age=temp;
					temp=cur->name;cur->name=cur->next->name;cur->next->name=temp;
					temp=cur->number;cur->number=cur->next->number;cur->next->number=temp;
					temp=cur->sex;cur->sex=cur->next->sex;cur->next->sex=temp;
					temp=cur->xi_bu;cur->xi_bu=cur->next->xi_bu;cur->next->xi_bu=temp;
					temp=cur->zhi_cheng;cur->zhi_cheng=cur->next->zhi_cheng;cur->next->zhi_cheng=temp;
					temp=cur->zhuan_ye;cur->zhuan_ye=cur->next->zhuan_ye;cur->next->zhuan_ye=temp;
				}
				cur=cur->next;
			}
			tail=cur;
			cur=head.next;
		}
		int count=0;//计数
		if(p)
		{
			system("cls");//清屏
			teacher_list();
			while(p)
			{
				p->point();
			 count++;
			 if(!p->next)//判断是否为最后一个节点
			 {
				__();
				cout<<p->xi_bu<<"教师共有"<<count<<"人。\n";
				break;
			 }
			 if(p->xi_bu!=p->next->xi_bu)
			 {
				__();
				cout<<p->xi_bu<<"教师共有"<<count<<"人。\n";
				count=0;cout<<endl<<endl;
				teacher_list();
			 }
			 p=p->next;
			}
		}
		else
			cout<<"信息为空!!!\n";
		break;
	}
	else if(a=="3")//按职称统计
	{
		Teacher *cur,*tail;
		cur=head.next;
		tail=NULL; 
		if(cur==NULL||cur->next==NULL)
			if(!head.next)//防止一个数据的情况
			   return;
		while(cur!=tail)
		{
			while(cur->next!=tail)
			{
				if(cur->zhi_cheng>cur->next->zhi_cheng)
				{
					string temp=cur->age;cur->age=cur->next->age;cur->next->age=temp;
					temp=cur->name;cur->name=cur->next->name;cur->next->name=temp;
					temp=cur->number;cur->number=cur->next->number;cur->next->number=temp;
					temp=cur->sex;cur->sex=cur->next->sex;cur->next->sex=temp;
					temp=cur->xi_bu;cur->xi_bu=cur->next->xi_bu;cur->next->xi_bu=temp;
					temp=cur->zhi_cheng;cur->zhi_cheng=cur->next->zhi_cheng;cur->next->zhi_cheng=temp;
					temp=cur->zhuan_ye;cur->zhuan_ye=cur->next->zhuan_ye;cur->next->zhuan_ye=temp;
				}
				cur=cur->next;
			}
			tail=cur;
			cur=head.next;
		}
		int count=0;//计数
		if(p)
		{
			system("cls");//清屏
			teacher_list();
			while(p)
			{
				p->point();
			 count++;
			 if(!p->next)//判断是否为最后一个节点
			 {
				__();
				cout<<p->zhi_cheng<<"教师共有"<<count<<"人。\n";
				break;
			 }
			 if(p->zhi_cheng!=p->next->zhi_cheng)
			 {
				__();
				cout<<p->zhi_cheng<<"教师共有"<<count<<"人。\n";
				count=0;cout<<endl<<endl;
				teacher_list();
			 }
			 p=p->next;
			}
		}
		else
			cout<<"信息为空!!!\n";
		break;
	}
	else if(a=="4")
		teacherfun(menu());
	else
		cout<<"您的输入有误,请重新输入:";
	}

}


int jdadd(Teacher *p2)//将节点加入链表
{
   Teacher *pt=&head;
   if(!p2)//判断是否为空节点
	   return 0;
   if(yn(p2->number))//判断该信息是否存在
	   {
		   cout<<"编号为"<<p2->number<<"的信息已经存在!\n";
		   return 0;
	   }
	   while(pt->next)//将指针移到最后一个节点
		   pt=pt->next;
	   pt->next=p2;
	   p2->next=NULL;
	   return 1;
}


void teacherSave()//保存信息到文件

{
	ofstream out("teacher.dat",ios::binary);
	Teacher *pstu = &head;
	int i = 0, count = rencount();
	if(!out)
	{
		cout<<"打开待写入的文件失败!\n";
		system("pause");teacherfun(menu());
	}
	if(question("您确定要保存吗?"))
	{
	out.write((char *) &count,sizeof(count));//把学生信息的数量先写入到文件头
	while(pstu->next)
	{
		out.write((char*) pstu->next,sizeof(Teacher));//把每位学生信息写入文件
		++i;
		pstu = pstu->next;
	}
	out.close();
	if(i == count)
	{
		printf("成功的写入了%d条教师信息。\n", count);
	}
	else
	{
		printf("应写入%d条教师信息,实际写入%d条教师信息。\n", count, i);
	}	
	}
}

void delall()//删除所有信息
{
	Teacher *p=head.next,*temp;
	int count=0;
	if(question("确定要删除当前所有信息吗?"))
	{
		while(p)
		{
			temp=p;
			p=p->next;
			free(temp);
			++count;
		}
		head.next=NULL;
		printf("共删除了%d条信息!\n",count);
	}
}

int rencount()//统计总人数
{
int count=0;
Teacher *p=&head;
while(p->next)
{
	count++;
	p=p->next;
}
printf("\n当前共有%d条信息。\n",count);
return(count);
}

/*************************************************************************/
void shiyanadd()
{
string num,na,se,shi,zhi;string ag;
	cout<<"请输入您要添加的信息!"<<endl;
	cout<<"编号:";cin>>num;
	while(shiyanyn(num))
	{
		cout<<"该编号已存在,请重新输入:\n";
		cin>>num;
	}
	cout<<"姓名:";cin>>na;
	cout<<"性别:";cin>>se;
	while(se!="男"&&se!="女") //判断性别是否规范
	{
		cout<<"输入的性别有误!!!\n请重新输入:";
		cin>>se;
	}
	cout<<"年龄:";cin>>ag;
	cout<<"实验室:";cin>>shi;
	cout<<"职务:";cin>>zhi;
	shiyan *T=new shiyan(num,na,se,ag,shi,zhi);//声明动态存储空间
	shiyanjdadd(T);//节点加入链表
}
int shiyanjdadd(shiyan *p1)//将节点加入链表
{
   shiyan *pt=&head1;
   if(!p1)//判断是否为空节点
	   return 0;
   if(shiyanyn(p1->number))//判断该信息是否存在
	   {
		   cout<<"编号为"<<p1->number<<"的信息已经存在!\n";
		   return 0;
	   }
	   while(pt->next)//将指针移到最后一个节点
		   pt=pt->next;
		 pt->next=p1;
	     p1->next=NULL;
	   return 1;
}
int shiyanyn(string num)//判断编号是否已存在
{
	shiyan *p=head1.next;
	while(p)
		if(num==p->number)
			return 1;
		else
			p=p->next;
	return 0;
}
void shiyansearch()//信息查找,可对结果进行编辑
{
	shiyan *p=head1.next;
	cout<<"请输入你要查找信息的编号或姓名:\n";
	string nn;
	cin>>nn;
	int i=0;
	shiyan *temp=&head1;//用于承接上一个节点,可能要删除第一个数据
	while(p)
	{
		if(nn==p->number||nn==p->name)
		{
			i++;
			shiyan_list();
			p->point();
			__();
			shiyanbain_ji(*temp);//编辑函数
		}
		temp=p;
		p=p->next;
	}
	if(!i)
		cout<<"您所查找的信息不存在!!!\n";
}
void shiyanbain_ji(shiyan &p1)//编辑函数,参数为上一个节点的引用,方便节点的拆分与插入
{
	string a;
	while(1)
	{
		cout<<"您可以对以上信息进行以下操作:\n";
		cout<<"1.修改         2.删除		3.返回主菜单\n您的选择是:";
		cin>>a;
		if(a =="1")
		{
			string se,num;
			cout<<"请输入您要修改信息!"<<endl;
			cout<<"编号:";cin>>num;
			while(shiyanyn(num))
			{
				if(num==p1.next->number)//编号也许不是修改内容
					break;
				cout<<"该编号已存在,请重新输入:\n";
				cin>>num;
			}
			p1.next->number=num;
			cout<<"姓名:";cin>>p1.next->name;
			cout<<"性别:";cin>>se;
			while(se!="男"&&se!="女") //判断性别是否规范
			{
				cout<<"输入的性别有误!!!\n请重新输入:";
				cin>>se;
			}
			p1.next->sex=se;
			cout<<"年龄:";cin>>p1.next->age;
			cout<<"实验室:";cin>>p1.next->shiyanshi;
			cout<<"职务:";cin>>p1.next->zhiwu;
			cout<<"信息修改成功!\n";
			break;
			}
		else if(a=="2")
		{
			if(question("确定要删除该信息吗?"))
			{
				shiyan *t=p1.next->next;
				p1.next=t;
				cout<<"删除成功!\n";
				break;
			}
		}
		else if(a=="3")
			shiyanfun(shiyanmenu());
		else
			cout<<"输入错误!!!\n请重新输入:";
	}
}
void shiyan_tong_ji()//定义统计函数
{
	shiyan *p=head1.next;
	if(!p)
	{
		cout<<"信息为空!!\n";
		return;
	}
	cout<<"你可以选择的统计方式:1.按性别统计	2.按实验室统计		3.返回主菜单\n请输入你的选择:";
	string a;
	while(1)
	{
	cin>>a;
	if(a=="1")//先冒泡排序,后统计,并将结果输出,按性别统计
	{
		shiyan *cur,*tail;
		cur=head1.next;
		tail=NULL; 
		if(cur==NULL||cur->next==NULL)
			if(!head1.next)//防止一个数据的情况
			   return;
		while(cur!=tail)
		{
			while(cur->next!=tail)
			{
				if(cur->sex>cur->next->sex)
				{
					string temp=cur->age;cur->age=cur->next->age;cur->next->age=temp;
					temp=cur->name;cur->name=cur->next->name;cur->next->name=temp;
					temp=cur->number;cur->number=cur->next->number;cur->next->number=temp;
					temp=cur->sex;cur->sex=cur->next->sex;cur->next->sex=temp;
					temp=cur->shiyanshi;cur->shiyanshi=cur->next->shiyanshi;cur->next->shiyanshi=temp;
					temp=cur->zhiwu;cur->zhiwu=cur->next->zhiwu;cur->next->zhiwu=temp;
				}
				cur=cur->next;
			}
			tail=cur;
			cur=head1.next;
		}
		int count=0;//计数
		if(p)
		{
			system("cls");//清屏
			shiyan_list();
			while(p)
			{
				p->point();
			 count++;
			 if(!p->next)//判断是否为最后一个节点
			 {
				__();
				cout<<p->sex<<"性实验员共有"<<count<<"人。\n";
				break;
			 }
			 if(p->sex!=p->next->sex)
			 {
				__();;
				cout<<p->sex<<"性实验员共有"<<count<<"人。\n";
				count=0;cout<<endl<<endl;
				shiyan_list();
			 }
			 p=p->next;
			}
		}
		else
			cout<<"信息为空!!!\n";
		break;
	}
	else if(a=="2")//按实验室统计
	{
		shiyan *cur,*tail;
		cur=head1.next;
		tail=NULL; 
		if(cur==NULL||cur->next==NULL)
			if(!head1.next)//防止一个数据的情况
			   return;
		while(cur!=tail)
		{
			while(cur->next!=tail)
			{
				if(cur->shiyanshi>cur->next->shiyanshi)
				{
					string temp=cur->age;cur->age=cur->next->age;cur->next->age=temp;
					temp=cur->name;cur->name=cur->next->name;cur->next->name=temp;
					temp=cur->number;cur->number=cur->next->number;cur->next->number=temp;
					temp=cur->sex;cur->sex=cur->next->sex;cur->next->sex=temp;
					temp=cur->shiyanshi;cur->shiyanshi=cur->next->shiyanshi;cur->next->shiyanshi=temp;
					temp=cur->zhiwu;cur->zhiwu=cur->next->zhiwu;cur->next->zhiwu=temp;
				}
				cur=cur->next;
			}
			tail=cur;
			cur=head1.next;
		}
		int count=0;//计数
		if(p)
		{
			system("cls");//清屏
			teacher_list();
			while(p)
			{
				p->point();
			 count++;
			 if(!p->next)//判断是否为最后一个节点
			 {
				__();
				cout<<p->shiyanshi<<"实验员共有"<<count<<"人。\n";
				break;
			 }
			 if(p->shiyanshi!=p->next->shiyanshi)
			 {
				__();
				cout<<p->shiyanshi<<"实验员共有"<<count<<"人。\n";
				count=0;cout<<endl<<endl;
				shiyan_list();
			 }
			 p=p->next;
			}
		}
		else
			cout<<"信息为空!!!\n";
		break;
	}
	else if(a=="3")
		shiyanfun(shiyanmenu());
	else
		cout<<"您的输入有误,请重新输入:";
	}

}
void shiyandelall()//删除所有信息
{
	shiyan *p=head1.next,*temp;
	int count=0;
	if(question("确定要删除当前所有信息吗?"))
	{
		while(p)
		{
			temp=p;
			p=p->next;
			free(temp);
			++count;
		}
		head1.next=NULL;
		printf("共删除了%d条信息!\n",count);
	}
}
int shiyanrencount()//统计总人数
{
int count=0;
shiyan *p=&head1;
while(p->next)
{
	count++;
	p=p->next;
}
printf("\n当前共有%d条信息。\n",count);
return(count);
}

void shiyanSave()//保存信息到文件
{
	ofstream out("shiyanyuan.dat",ios::binary);
	shiyan *pstu = &head1;
	int i = 0, count = shiyanrencount();
	if(!out)
	{
		cout<<"打开待写入的文件失败!\n";
		system("pause");shiyanfun(shiyanmenu());
	}
	if(question("您确定要保存吗?"))
	{
	out.write((char *) &count,sizeof(count));//把信息的数量先写入到文件头
	while(pstu->next)
	{
		out.write((char*) pstu->next,sizeof(shiyan));//把信息写入文件
		++i;
		pstu = pstu->next;
	}
	out.close();
	if(i == count)
	{
		printf("成功的写入了%d条信息。\n", count);
	}
	else
	{
		printf("应写入%d条信息,实际写入%d条信息。\n", count, i);
	}	
	}
}
/*********************************************************************/
void xzadd()  //添加函数
{
	string num,na,se,xi,zhuan,zhi;string ag;
	cout<<"请输入您要添加的信息!"<<endl;
	cout<<"编号:";cin>>num;
	while(xzyn(num))
	{
		cout<<"该编号已存在,请重新输入:\n";
		cin>>num;
	}
	cout<<"姓名:";cin>>na;
	cout<<"性别:";cin>>se;
	while(se!="男"&&se!="女") //判断性别是否规范
	{
		cout<<"输入的性别有误!!!\n请重新输入:";
		cin>>se;
	}
	cout<<"年龄:";cin>>ag;
	cout<<"部门:";cin>>xi;
	cout<<"政治面貌:";cin>>zhuan;
	cout<<"职称:";cin>>zhi;
	xingzheng *T=new xingzheng(num,na,se,ag,xi,zhuan,zhi);//声明动态存储空间
	xzjdadd(T);//节点加入链表
}
int xzyn(string num)//判断编号是否已存在
{
	xingzheng *p=head2.next;
	while(p)
		if(num==p->number)
			return 1;
		else
			p=p->next;
	return 0;
}
void xzsearch()//信息查找,可对结果进行编辑
{
	xingzheng *p=head2.next;
	cout<<"请输入你要查找信息的编号或姓名:\n";
	string nn;
	cin>>nn;
	int i=0;
	xingzheng *temp=&head2;//用于承接上一个节点,可能要删除第一个数据
	while(p)
	{
		if(nn==p->number||nn==p->name)
		{
			i++;
			xingzheng_list();
			p->point();
			__();
			xzbain_ji(*temp);//编辑函数
		}
		temp=p;
		p=p->next;
	}
	if(!i)
		cout<<"您所查找的信息不存在!!!\n";
}
void xzbain_ji(xingzheng &p1)//编辑函数,参数为上一个节点的引用,方便节点的拆分与插入
{
	string a;
	while(1)
	{
		cout<<"您可以对以上信息进行以下操作:\n";
		cout<<"1.修改         2.删除		3.返回主菜单\n您的选择是:";
		cin>>a;
		if(a =="1")
		{
			string se,num;
			cout<<"请输入您要修改信息!"<<endl;
			cout<<"编号:";cin>>num;
			while(yn(num))
			{
				if(num==p1.next->number)//编号也许不是修改内容
					break;
				cout<<"该编号已存在,请重新输入:\n";
				cin>>num;
			}
			p1.next->number=num;
			cout<<"姓名:";cin>>p1.next->name;
			cout<<"性别:";cin>>se;
			while(se!="男"&&se!="女") //判断性别是否规范
			{
				cout<<"输入的性别有误!!!\n请重新输入:";
				cin>>se;
			}
			p1.next->sex=se;
			cout<<"年龄:";cin>>p1.next->age;
			cout<<"部门:";cin>>p1.next->bumen;
			cout<<"政治面貌:";cin>>p1.next->zhengzhi;
			cout<<"职称:";cin>>p1.next->zhicheng;
			cout<<"信息修改成功!\n";
			break;
			}
		else if(a=="2")
		{
			if(question("确定要删除该信息吗?"))
			{
				xingzheng *t=p1.next->next;
				p1.next=t;
				cout<<"删除成功!\n";
				break;
			}
		}
		else if(a=="3")
			xzfun(xzmenu());
		else
			cout<<"输入错误!!!\n请重新输入:";
	}
}
void xz_tong_ji()//定义统计函数
{
	xingzheng *p=head2.next;
	if(!p)
	{
		cout<<"信息为空!!\n";
		return;
	}
	cout<<"你可以选择的统计方式:1.按性别统计	2.按部门统计	3.按职称统计		4.返回主菜单\n请输入你的选择:";
	string a;
	while(1)
	{
	cin>>a;
	if(a=="1")//先冒泡排序,后统计,并将结果输出,按性别统计
	{
		xingzheng *cur,*tail;
		cur=head2.next;
		tail=NULL; 
		if(cur==NULL||cur->next==NULL)
			if(!head2.next)//防止一个数据的情况
			   return;
		while(cur!=tail)
		{
			while(cur->next!=tail)
			{
				if(cur->sex>cur->next->sex)
				{
					string temp=cur->age;cur->age=cur->next->age;cur->next->age=temp;
					temp=cur->name;cur->name=cur->next->name;cur->next->name=temp;
					temp=cur->number;cur->number=cur->next->number;cur->next->number=temp;
					temp=cur->sex;cur->sex=cur->next->sex;cur->next->sex=temp;
					temp=cur->bumen;cur->bumen=cur->next->bumen;cur->next->bumen=temp;
					temp=cur->zhengzhi;cur->zhengzhi=cur->next->zhengzhi;cur->next->zhengzhi=temp;
					temp=cur->zhicheng;cur->zhicheng=cur->next->zhicheng;cur->next->zhicheng=temp;
				}
				cur=cur->next;
			}
			tail=cur;
			cur=head2.next;
		}
		int count=0;//计数
		if(p)
		{
			system("cls");//清屏
			xingzheng_list();
			while(p)
			{
				p->point();
			 count++;
			 if(!p->next)//判断是否为最后一个节点
			 {
				__();
				cout<<p->sex<<"性共有"<<count<<"人。\n";
				break;
			 }
			 if(p->sex!=p->next->sex)
			 {
				__();;
				cout<<p->sex<<"性共有"<<count<<"人。\n";
				count=0;cout<<endl<<endl;
				xingzheng_list();
			 }
			 p=p->next;
			}
		}
		else
			cout<<"信息为空!!!\n";
		break;
	}
	else if(a=="2")//按部门统计
	{
		xingzheng *cur,*tail;
		cur=head2.next;
		tail=NULL; 
		if(cur==NULL||cur->next==NULL)
			if(!head2.next)//防止一个数据的情况
			   return;
		while(cur!=tail)
		{
			while(cur->next!=tail)
			{
				if(cur->bumen>cur->next->bumen)
				{
					string temp=cur->age;cur->age=cur->next->age;cur->next->age=temp;
					temp=cur->name;cur->name=cur->next->name;cur->next->name=temp;
					temp=cur->number;cur->number=cur->next->number;cur->next->number=temp;
					temp=cur->sex;cur->sex=cur->next->sex;cur->next->sex=temp;
					temp=cur->bumen;cur->bumen=cur->next->bumen;cur->next->bumen=temp;
					temp=cur->zhengzhi;cur->zhengzhi=cur->next->zhengzhi;cur->next->zhengzhi=temp;
					temp=cur->zhicheng;cur->zhicheng=cur->next->zhicheng;cur->next->zhicheng=temp;
				}
				cur=cur->next;
			}
			tail=cur;
			cur=head2.next;
		}
		int count=0;//计数
		if(p)
		{
			system("cls");//清屏
			xingzheng_list();
			while(p)
			{
				p->point();
			 count++;
			 if(!p->next)//判断是否为最后一个节点
			 {
				__();
				cout<<p->bumen<<"共有"<<count<<"人。\n";
				break;
			 }
			 if(p->bumen!=p->next->bumen)
			 {
				__();;
				cout<<p->bumen<<"共有"<<count<<"人。\n";
				count=0;cout<<endl<<endl;
				xingzheng_list();
			 }
			 p=p->next;
			}
		}
		else
			cout<<"信息为空!!!\n";
		break;
	}
	else if(a=="3")//按职称统计
	{
		xingzheng *cur,*tail;
		cur=head2.next;
		tail=NULL; 
		if(cur==NULL||cur->next==NULL)
			if(!head2.next)//防止一个数据的情况
			   return;
		while(cur!=tail)
		{
			while(cur->next!=tail)
			{
				if(cur->zhicheng>cur->next->zhicheng)
				{
					string temp=cur->age;cur->age=cur->next->age;cur->next->age=temp;
					temp=cur->name;cur->name=cur->next->name;cur->next->name=temp;
					temp=cur->number;cur->number=cur->next->number;cur->next->number=temp;
					temp=cur->sex;cur->sex=cur->next->sex;cur->next->sex=temp;
					temp=cur->bumen;cur->bumen=cur->next->bumen;cur->next->bumen=temp;
					temp=cur->zhengzhi;cur->zhengzhi=cur->next->zhengzhi;cur->next->zhengzhi=temp;
					temp=cur->zhicheng;cur->zhicheng=cur->next->zhicheng;cur->next->zhicheng=temp;
				}
				cur=cur->next;
			}
			tail=cur;
			cur=head2.next;
		}
		int count=0;//计数
		if(p)
		{
			system("cls");//清屏
			xingzheng_list();
			while(p)
			{
				p->point();
			 count++;
			 if(!p->next)//判断是否为最后一个节点
			 {
				__();
				cout<<p->zhicheng<<"共有"<<count<<"人。\n";
				break;
			 }
			 if(p->sex!=p->next->sex)
			 {
				__();;
				cout<<p->zhicheng<<"共有"<<count<<"人。\n";
				count=0;cout<<endl<<endl;
				xingzheng_list();
			 }
			 p=p->next;
			}
		}
		else
			cout<<"信息为空!!!\n";
		break;
	}
	else if(a=="4")
		xzfun(xzmenu());
	else
		cout<<"您的输入有误,请重新输入:";
	}
}

void xzSave()//保存信息到文件
{
	ofstream out("xz.dat",ios::binary);
	xingzheng *pstu = &head2;
	int i = 0, count = xzrencount();
	if(!out)
	{
		cout<<"打开待写入的文件失败!\n";
		system("pause");xzfun(xzmenu());
	}
	if(question("您确定要保存吗?"))
	{
	out.write((char *) &count,sizeof(count));//把信息的数量先写入到文件头
	while(pstu->next)
	{
		out.write((char*) pstu->next,sizeof(xingzheng));//把信息写入文件
		++i;
		pstu = pstu->next;
	}
	out.close();
	if(i == count)
	{
		printf("成功的写入了%d条信息。\n", count);
	}
	else
	{
		printf("应写入%d条信息,实际写入%d条信息。\n", count, i);
	}	
	}
}
int xzjdadd(xingzheng *p1)//将节点加入链表
{
  xingzheng *pt=&head2;
   if(!p1)//判断是否为空节点
	   return 0;
   if(xzyn(p1->number))//判断该信息是否存在
	   {
		   cout<<"编号为"<<p1->number<<"的信息已经存在!\n";
		   return 0;
	   }
	   while(pt->next)//将指针移到最后一个节点
		   pt=pt->next;
	   pt->next=p1;
	   p1->next=NULL;
	   return 1;
}
void xzdelall()//删除所有信息
{
	xingzheng *p=head2.next,*temp;
	int count=0;
	if(question("确定要删除当前所有信息吗?"))
	{
		while(p)
		{
			temp=p;
			p=p->next;
			free(temp);
			++count;
		}
		head2.next=NULL;
		printf("共删除了%d条信息!\n",count);
	}
}

int xzrencount()//统计总人数
{
int count=0;
xingzheng *p=&head2;
while(p->next)
{
	count++;
	p=p->next;
}
printf("\n当前共有%d条信息。\n",count);
return(count);
}
void home()//首页
{
	system("cls");
	char c;
	cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl;
	cout<<"				1.教师信息管理系统	2.实验员信息管理系统	3.行政人员信息管理系统	4.退出\n";
	cout<<endl;
	cout<<"								请选择管理系统:";
	while(1)
	{
	cin>>c;
	if(c=='1')//默认自动读取文件
	{
		int i, count = 0;
		FILE *pf;
		Teacher *pstu;
		if((pf = fopen("teacher.dat", "rb")) == NULL)
		{
		cout<<"当前信息为空,请载入文件或输入信息!!!\n";
		system("pause"); teacherfun(menu());
		}
		fread(&count, 1, sizeof count, pf);//将信息数目从文件中读出
		for(i = 0;i<count;i++)
		{
		Teacher *pstu = new Teacher;
		fread(pstu, 1, sizeof(Teacher), pf);  
		jdadd(pstu);
		}
		fclose(pf);
		teacherfun(menu());
	}
	else if(c=='2')
	{
		int i, count = 0;
		ifstream in("shiyanyuan.dat",ios::binary);
		if(!in)
		{
		cout<<"当前信息为空,请载入文件或输入信息!!!\n";
		system("pause"); shiyanfun(shiyanmenu());
		}
		in.read((char *) &count,sizeof(count));//将信息数目从文件中读出
		for(i = 0;i<count;i++)
		{
		shiyan *pstu = new shiyan;
		in.read((char*) pstu,sizeof(shiyan)); 
		shiyanjdadd(pstu);
		}
		in.close();
		shiyanfun(shiyanmenu());
	}
	else if(c=='3')
	{
		int i, count = 0;
		ifstream in("xz.dat",ios::binary);
		if(!in)
		{
		cout<<"当前信息为空,请载入文件或输入信息!!!\n";
		system("pause"); xzfun(xzmenu());
		}
		in.read((char *) &count,sizeof(count));//将信息数目从文件中读出
		for(i = 0;i<count;i++)
		{
		xingzheng *pstu = new xingzheng;
		in.read((char*) pstu,sizeof(xingzheng)); 
		xzjdadd(pstu);
		}
		in.close();
		xzfun(xzmenu());
	}
	else if(c=='4')
	{
		tuichu();
		exit(1);
	}
	else
		cout<<"输入错误,请重新输入:\n";
	}
}
void huanying()//欢迎语
{
	cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl;
	PlaySound(TEXT("hello.wav"), NULL, SND_FILENAME | SND_ASYNC);
	cout<<"                                                    欢迎使用高校人才信息管理系统\n";
	cout<<endl<<endl;
	cout<<"                                Welcome to the use of university talent information management system.\n\n";
}
void tuichu()//感谢语
{
	 system("cls");
	 cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl;
	 cout<<"                                                感谢您使用高校人才信息管理系统,再见!\n";
	 cout<<endl<<endl;
	 cout<<"                                Thank you for using the university talent information management system, goodbye!\n\n";
	 PlaySound(TEXT("退出音效.wav"), NULL, SND_FILENAME | SND_SYNC);
	 exit(0);
}
void login()//登陆验证
{
	    int i=3,j=0;
		char password1[20]="201821111134",user[20],password[20];
		char user1[20]={"徐世兴"},ch;
		huanying();
	    cout<<"                                                        请输入您的用户名:";
		scanf("%s",user);
		while(strcmp(user1,user)!=0)
		{
			printf("                                                        该用户名不存在,请重新输入! 您还有%d次机会。\n\n",i);
			printf("                                                        请您重新输入:");
			scanf("%s",user);
			i--;
			if(!i)
				 {
					tuichu();
			}
		}
		printf("                                                        请输入您的密码:");
		ch=getch();
		while(ch!='\r'||ch=='\b')
		{
			if(ch!='\b')
			{
			password[j]=ch;
			printf("*");
			j++;
			}
			else
			{
				j-=1;
				printf("\b");
				printf(" ");
				printf("\b");
			}
			ch=getch();
		}
		i=3;password[j]=NULL;
		while(strcmp(password1,password)!=0)
		{
			printf("\n                                              密码错误,请重新输入! 您还有%d次机会。\n",i);
			printf("                                                        请您重新输入:");
			ch=getch();
			j=0;
		while(ch!='\r'||ch=='\b')
		{
			if(ch!='\b')
			{
			password[j]=ch;
			printf("*");j++;
			}
			else
			{
				j-=1;
				printf("\b");
				printf(" ");
				printf("\b");
			}
			ch=getch();
		}
			i--;
			if(!i)
				 {
					tuichu();
			     }
		}
}


int main()
{
	login();
	home();
	return 0;
}
发布了33 篇原创文章 · 获赞 27 · 访问量 74

猜你喜欢

转载自blog.csdn.net/weixin_46165788/article/details/105532057