永发信息网

Vc++,急求!定义一个成绩类CScore,包含三个数据成员,再设计一个学生类,其中score是类CScore的对象。

答案:2  悬赏:20  手机版
解决时间 2021-04-02 01:27
  • 提问者网友:喧嚣尘世
  • 2021-04-01 01:33
Vc++,急求!定义一个成绩类CScore,包含三个数据成员,再设计一个学生类,其中score是类CScore的对象。
最佳答案
  • 五星知识达人网友:封刀令
  • 2021-04-01 02:15
#include
#include
class CScore{
float maths;
float english;
float physics;
public:
CScore(float,const float,float)
};
class student{
char name[10];
char no[10];
CScore score;
public:
student(const char*,const char*,CScore)
void Print();
};
student::student(const char*na,const char*n,CScore score)
{
strcpy(name,na);
strcpy(no,n);
this->score = score;
}
void student::Print()
{
}
void main(void)
{

}

针对CScore的三个数据域,还要写get操作。追问get操作怎么写呢?我试了很多回,还是发现有错误。追答float getMaths()
{
return maths;
}
其他的一样。
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯