- 8
- 0
- 约 8页
- 2016-12-24 发布于河南
- 举报
按照下图的类层次要求编写程序。定义属于类score的对象c1及类teacher的对象t1,分别输入各数据成员的值后显示出这些数据。
engmath
eng
math
sno
old
dep
degree
tel
addr
name
stud
teacher
person
student
score
id
源程序:
//科目:C++实验5
//题目:定义属于类score的对象c1及类teacher的对象t1
//作者:武叶
//语言:C++
//创作时间:2012年4月14日
#includeiostream
#includestring
using namespace std;
class person{
public:
person(string name1,string id1)
{
name=name1;
id=id1;
}
void print()
{
cout姓名:nameendl;
cout 身份证:idendl;
}
public:
string name ;
string id;
};
class teacher: public person{
public:
teacher(string degree1,string dep1,string name1,string i
原创力文档

文档评论(0)