这个继承怎么写?
红色部分#include <iostream.h>
#include <string.h>
char level(float a);
class student
{
private:
static int count;
static float allgrade;
char *no;
char *name;
float grade;
public:
student(){}
student(char *no1,char *name1,float grade1)
{
no=new char[strlen(no1)+1];
strcpy(no,no1);
name=new char[strlen(name1)+1];
strcpy(name,name1);
grade=grade1;
allgrade+=grade;
count++;
}
~student()
{
delete []name;
delete []no;
}
void setxx(char *no1,char *name1,float grade1)
{
no=new char[strlen(no1)+1];
strcpy(no,no1);
name=new char[strlen(name1)+1];
strcpy(name,name1);
grade=grade1;
allgrade+=grade;
count++;
}
void showxx()
{
cout<<"\n编号="<<no<<"\n姓名="<<name<<"\n成绩="<<grade<<endl;
}
void allxx()
{
cout<<"\n\n团队人数="<<count<<"\n总成绩="<<allgrade<<"\n评定级别="<<level(allgrade)<<endl;
}
char level(float a)
{
char temp;
if(a>0&&a<30)
temp='D';
if(a>30&&a<60)
temp='C';
if(a>60&&a<90)
temp='B';
if(a>90&&a<=a)
temp='A';
return temp;
}
};
class studentA:public student
{
private:
float ave;
public:
studentA(float avegrade):student(char *no,char *name,float grade)
{
avegrade=allgrade/count;
ave=avegrade;
}
void Aallshow()
{
student::allxx();
cout<<"\n平均成绩="<<ave;
}
};
int student::count=0;
float student::allgrade=0.0;
int main()
{
student p1,p2("95001","Ishimura Maiiho",89);
p1.setxx("95002","Shimizu Saki",83);
p2.showxx();
p1.showxx();
p2.allxx();
studentA p3;
p3.Aallxx();
return 0;
}