c++ 程序帮看一下为什么运行不了

来源:百度知道 编辑:UC知道 时间:2024/05/12 16:04:33
// Note:Your choice is C++ IDE
#include <iostream>
#include <cstring>
using namespace std;
class CPerson
{public:
CPerson(){}//
CPerson(char *name,int age,char sex='M')//
{strcpy(this->name,name);
this->age=age;
this->sex=sex;
}
void ShowInfo()
{cout<<"姓名:"<<name<<endl;
cout<<"性别:"<<(sex=='M'?"男":"女")<<endl;//
cout<<"年龄:"<<age<<endl;
}
private:
char name[20];
int age;
char sex;
};
class CStudent:virtual public CPerson
{public:
CStudent(char *name,int age,char sex='M')
:CPerson(name,age,sex)
{}
void SetData(char *strname,char *stuno,float s1,float s2,float s3)
{strcpy(this->classname,strname);//
strcpy(this->stuno,stuno);
score[0]=s1;
sco

// Note:Your choice is C++ IDE
#include <iostream>
#include <cstring>
using namespace std;
class CPerson
{public:
CPerson(){}//
CPerson(char *name,int age,char sex='M')//
{strcpy(this->name,name);
this->age=age;
this->sex=sex;
}
void ShowInfo()
{cout<<"姓名:"<<name<<endl;
cout<<"性别:"<<(sex=='M'?"男":"女")<<endl;//
cout<<"年龄:"<<age<<endl;
}
private:
char name[20];
int age;
char sex;
};
class CStudent:virtual public CPerson
{public:
CStudent(char *name,int age,char sex='M')
:CPerson(name,age,sex)
{}
void SetData(char *strname,char *stuno,float s1,float s2,float s3)
{strcpy(this->classname,strname);//
strcpy(this->stuno,stuno);
score[0]=s1;
score[1]=s2; <