金山学院C++课程实验报告
class CTeacher:public Person
{public:
void getInfo()
{
cin>>name>>sex>>age>>title>>lesson;cout<<endl;}
void newname(string n){name =n;}
void newage(int m){age=m;}
void mewtitle(string l){title=l;}
void display()
{Person::display();
cout<<"职称:"<<title<<endl;
cout<<"担任课程:"<<lesson<<endl;
}
protected:string title;
string lesson;
};
class CStudent: public Person
{public :
void getInfo()
{
cin>>name>>sex>>age>>num>>depa>>xvefen;cout<<endl;
}
void newxingming(string n)
{name=n;}
void newmun(int m)
{num=m;}
void xvefenadd(int c)
{xvefen+=c;}
void display()
{Person::display();
cout<<"学号:"<<num<<endl;
cout<<"系别:"<<depa<<endl;
cout<<"学分:"<<xvefen<<endl;}
protected:int num; string depa;int xvefen;
};
class CGraduateStudent:public CStudent
{
public:
void getInfo()
{
cin>>name>>sex>>age>>num>>depa>>xvefen>>tname>>lunwen;cout<<endl;} void lunwenadd(int c)
{lunwen+=c;}
void display()
{CStudent::display();
cout<<"导师:"<<tname<<endl;