#include
#include
using namespace std;
class student
{
public:
student(int number1,string name1,float score1)
{
number=number1;
name=name1;
score=score1;
}
void print()
{
cout<<“学号:”<<number<<endl;
cout<<“姓名:”<<name<<endl;
cout<<“成绩:”<<score<<endl;
}
protected:
int number;
string name;
float score;
};
class ustudent:public student{
public:
ustudent(int number1,string name1,float score1,int number2,string name2,float score2,int number3,string name3,float score3,string major1):student(number1,name1,score1),auditor3(number3,name3,score3),auditor2(number2,name2,score2)
{
major=major1;
}
void print()
{
cout<<“正式生是:”<<endl;
student::print();
cout<<“专业:”<<major<<endl;
}
void print_auditor3()
{
cout<<“旁听生是:”<<endl;
auditor3.print();
}
void print_auditor2()
{
cout<<“旁听生是:”<<endl;
auditor2.print();
}
private:
string major;
student auditor2;
student auditor3;
};
int main1()
{
ustudent stu(2001,“张三”,89,3001,“王五”,90,3002,“李四”,99,“数学”);
stu.print();
stu.print_auditor2();
stu.print_auditor3();
return 0;
}