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

📄 gelie.cpp

📁 企业人事管理系统,有查询统计各类人事的相关信息
💻 CPP
字号:
#include<iostream.h>
#include<string.h>
#include<fstream.h>
#include "gelie.h"
//day类的实现
    day::day(int y,int m,int d)
	{ 
		year=y;
		month=m;
		date=d;
	}
    day::~day() {}
    day::day(day&one)
	{  date=one.date;
        month=one.month;
        year=one.year; 
	}
    void day::Setday()
	{
		cout<<"请输入出生日期(年月日之间以空格键或回车键分开):";
		cin>>year>>month>>date;
	}
    void day::Getday()
	{
		cout<<"出生日期为:"<<year<<"年"<<month<<"月"<<date<<"日"<<endl;
	}
//people类的实现
    people::people(){}
    people:: people(char*name,int number,char*sex,char*id,day bir)
	{
		birthday=bir;
	}
    people::~people(){}
    void people::Setpeople()
    {
       cout<<"请输入姓名:";
	   cin>>name;
	   cout<<"请输入编号:";
	   cin>>number;
      cout<<"请输入该人的性别(x代表女,y代表男):";
	  cin>>sex; 
	  cout<<"请输入身份证号码:";
	  cin>>id;
      birthday.Setday();
	}
    void people::Getpeople()
{
     cout<<"该人的姓名为:"<<name<<endl;
	 cout<< "该人的编号为:"<<number<<endl;
     cout<<"该人的性别为:";
	 if(sex=='x')
		 cout<<"女"<<endl;
	     else cout<<"男"<<endl;
      cout<<"该人的身份证号码为:"<<id<<endl;
	  birthday.Getday();
}
   void people::operator==(people p1)
{
   if(id==p1.id)
	   cout<<"这两个people类对象的id相同"<<endl;
   else 
	   cout<<"这两个people类的对象的id不相同"<<endl;
}
void people::operator=(people p2)
{   people p;
   strcpy(name,p2.name);
   number=p2.number;
   sex=p2.sex;
   strcpy(id,p2.id);
   birthday=p2.birthday; 
}
   
//student类的实现
    
    student::student(){}
    
    student::~student(){}
    void student::Setstudent1()
	{
		people::Setpeople();
	}
    void student::Setstudent2()
	{
		cout<<"请输入班号:";
		cin>>classNO;
	}
    void student::Getstudent1()
	{
		people::Getpeople();
	}
    void student::Getstudent2()
	{
		cout<<"该学生的班号为:"<<classNO<<endl;
	}

//teacher类的实现 

   //teacher::teacher(){}   
   teacher::~teacher(){}
   teacher::teacher()
   {
	   cout<<"拷贝构造函数被调用";
   }
   void teacher::Setteacher1()
   {
	   people::Setpeople();
   }
   void teacher::Setteacher2()
   {
	   cout<<"请输入老师的职务:";
	   cin>>principalship;		   
       cout<<"请输入老师的部门:";
	   cin>>department;

	   	ofstream outfile;
	    outfile.open("out.txt");
     	if (!outfile)
    	cout<<"Cannot open out.txt for output!\n";	
    	outfile<<principalship<<'\n';
    	outfile.close();




   }
   void teacher::Getteacher1()
   {
	   people::Getpeople();
   }
   void teacher::Getteacher2()
   {
	   cout<<"该老师的职务是:" <<principalship<<endl;
	   cout<<"该老师的部门是:"<<department<<endl;
   }


/*
   void teacher::io_out()              //把数据输出到文件的方法,用于普通好友类
   {		
	ofstream outfile;
	outfile.open("out.txt");
	if (!outfile)
	cout<<"Cannot open out.txt for output!\n";	
	outfile<<principalship<<'\n';
	outfile.close();	
   }
*/






//graduate类的实现

   graduate::graduate(){}
   graduate::~graduate(){};
   void graduate::Setgraduate1()
   {
	   student::Setstudent1();
	   student::Setstudent2();
   }
   void graduate::Setgraduate2()
   { 
	   cout<<"请输入专业:";
	   cin>>subject;
	   cout<<"请输入导师的信息为:"<<endl;
   teacheradviser.Setteacher1();
   teacheradviser.Setteacher2();
   }
   void graduate::Getgraduate1()
   {
	   student::Getstudent1();
	   student::Getstudent2();
   }
   void graduate::Getgraduate2()
   {
	   cout<<"该研究生的专业为:"<<subject<<endl;
	   cout<<"导师的信息为:"<<endl;
   teacheradviser.Getteacher1();
   teacheradviser.Getteacher2();
   }

//TA类的实现

TA::TA(){}
TA::~TA(){}
void TA::SetTA()
{
	student::Setstudent1();
	student::Setstudent2();
	graduate::Setgraduate2();
     cout<<"请输入该助教生的助教信息:"<<endl;
     teacher::Setteacher2();
     cout<<"请输入助教生的工作时间:";
	 cin>>time;
	 cout<<"请输入助教生的工资:";
	 cin>>pay;
}
void TA::GetTA()
{
	student::Getstudent1();
	student::Getstudent2();
	graduate::Getgraduate2();
cout<<"该助教生的助教信息为:"<<endl;
teacher::Getteacher2();
cout<<"该助教生的工作时间为:"<<time<<endl;
cout<<"该助教生的工资为:"<<pay<<endl;
}




⌨️ 快捷键说明

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