📄 class.cpp
字号:
#include"class.h"
//|---------------------------|str类函数定义
istream &operator >>(istream &in,str &zfc1)
{
in>>zfc1.m_string;
return in;
}
ostream &operator <<(ostream &out,str &afc2)
{
out<<afc2.m_string;
return out;
}
int str::operator ==(str &b)
{
if(!strcmp(m_string,b.m_string))
return 1;
else
return 0;
}
//|---------------------------|student类函数定义
extern int number;
void find(person *shuzu[])
{
bool h=1; //h用来标记,如果h=1则则表示未找到数据
str name;
cout<<"请输入要查找人的名字"<<endl;
cin>>name;
for(int i=0;i<number/*shuzu[i]*/;i++)
{
if(shuzu[i]->m_name==name)
{
shuzu[i]->print();
cout<<endl;
h=0;
}
else
{
if((number==i+1)&&h)
cout<<"你要找的人不再资料库中"<<endl;
}
}
}
// int student::s_renshu=0;
void student::setinformation()
{
//cout<<"请按指示输入此学生的信息(注意:每一项用空格隔开)"<<endl;
int year,month,day;
person::setinformation();
cout<<"学号----专业----班级----入学时间(年,月,日,)"<<endl;
cin>>m_number>>m_department>>m_grade>>year>>month>>day;
CTime time(year,month,day,0,0,0);
m_time=time;
}
void student::print()
{
//cout<<"Student"<<s_renshu<<endl;
person::print();
cout<<"\t学号:"<<m_number<<"\t专业:"<<m_department<<"\t班级:"<<m_grade<<"\t入学时间:"<<m_time.Format("%Y,%b,%d")<<endl;
cout<<"|--------------------------------------------------|"<<endl;
}/*void student::find()
{
for(int j=0;j<=i;j++)
if(*this==m_data[i] )
cout<<"find"<<endl;
else
cout<<"not"<<endl;
}*/
//|-------------------------|facluty类函数定义
//int faculty::f_renshu=0;
void faculty::setinformation()
{
//cout<<"请输入此教员的信息(注意:每一项用空格隔开)"<<endl;
person::setinformation();
cout<<"工资---职称"<<endl;
cin>>m_salary>>m_zhicheng;
}
void faculty::print()
{
//cout<<"Facultu"<<f_renshu<<endl;
person::print();
cout<<"\t工资:"<<m_salary<<"\t职称:"<<m_zhicheng<<endl;
cout<<"|---------------------------------------|"<<endl;
}
//|--------------------------|professor类的成员函数
//int professor::p_renshu=0;
void professor::setinformation()
{
//cout<<"请输入此教授的信息(注意:每一项用空格隔开)"<<endl;
faculty::setinformation();
cout<<"电话"<<endl;
cin>>p_telephone;
}
void professor::print()
{
// cout<<"Professor"<<p_renshu<<endl;
faculty::print();
cout<<"\t电话"<<p_telephone<<endl;
cout<<"|--------------------------------------|"<<endl;
}
//|------------------------|studentFaculty类的函数定义
//int studentFaculty::sF_renshu=0;
void studentFaculty::setinformation()
{
//cout<<"请输入此教员的信息"<<endl;
student::setinformation();
cout<<"工资----职称"<<endl;
cin>>m_salary>>m_zhicheng;
}
void studentFaculty::print()
{
//cout<<"studentFaculty:"<<sF_renshu<<endl;
student::print();
cout<<"\t工资:"<<faculty::m_salary<<"\t职称:"<<faculty::m_zhicheng<<endl;
cout<<"|----------------------------------------|"<<endl;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -