帮忙看看问题?

来源:百度知道 编辑:UC知道 时间:2024/05/22 13:33:10
class score
{
public:
score(char*);

char* m_pszKemu;
int m_nScore;
};
class stu
{
public:
stu(char*);
score m_pMathScore;
score m_pEnglishScore;
score m_pLitScore;

private:
char* m_pszStuNam;
int m_nAver;
int m_nRaw;

public:
float setAverage();
};

#include<iostream.h>
#include"student.h"

float stu::setAverage()
{
float aver=(float)(m_pMathScore->m_nScore+m_pEnglishScore->m_nScore
+m_pLitScore->m_nScore)/3;
cout<<aver<<endl;
return aver;
}

stu::stu(char* name)
{
m_pszStuNam= name;

m_pMathScore= new score("数学成绩:");
m_pEnglishScore= new score("英语成绩:");
m_pLitScore = new score("语文成绩:");

int n;
cout<<"输入数学成绩:"<<endl;
cin>>n;
m_pMathSco

改了一下,可以运行了。
#include<iostream.h>

class score
{
public:
score(char*);

char* m_pszKemu;
int m_nScore;
};

score::score(char* Kemu)
{
m_pszKemu=Kemu;
}

class stu
{
public:
stu(char*);
score *m_pMathScore;
score *m_pEnglishScore;
score *m_pLitScore;

private:
char* m_pszStuNam;
int m_nAver;
int m_nRaw;

public:
float setAverage();
};

stu::stu(char* name)
{
m_pszStuNam=name;

m_pMathScore=new score("Êýѧ³É¼¨£º");
m_pEnglishScore=new score("Ó¢Óï³É¼¨£º");
m_pLitScore=new score("ÓïÎijɼ¨£º");

int n;
cout<<"ÊäÈëÊ&