因为要在老师用来评考的系统中运行,就是说系统给赋值运行……
#include<iostream>
#include<string>
using namespace std;
class Teacher
{public:
void display();
protected:
string name;
int age;
char sex;
string addr;
double tel;
string title;};
void Teacher::display()
{cout<<"name:"<<name<<endl;
cout<<"age:"<<age<<endl;
cout<<"sex:"<<sex<<endl;
cout<<"title:"<<title<<endl;
cout<<"address:"<<addr<<endl;
cout<<"telephone number:"<<tel<<endl;}
class Cadre{
protected:
string name;
int age;
char sex;
string addr; d
ouble tel;
string post;};
class Teacher_Cadre:public Teacher,public Cadre
{public:
void set();
void show();
private:
double wages;};
void Teacher_Cadre::set()
{cin>>Teacher::name>>Teacher::age>>Teacher::sex>>Teacher::title>>Cadre::post;
getline(cin,Teacher::addr);
cin>>Teacher::tel>>wages;}
void Teacher_Cadre::show()
{display();
cout<<"post:"<<Cadre::post<<endl;
cout<<"wages:"<<wages<<endl;}
int main()
{Teacher_Cadre a;
a.set();
a.show();
return 0;}
求指教……万分感谢……
