#include<iostream>
using namespace std;
class student
{
public:
void show_student ()
{
cout<<"name"<<":"<<name<<endl;
cout<<"chinese"<<":"<<chinese<<endl;
cout<<"math"<<":"<<math<<endl;
}
void set_student (char*p,double a,double b)
{
name=new char[strlen(p)+1];
strcpy(name,p);
chinese=a;
math=b;
}
private:
char *name;
double chinese;
double math;
};
int main()
{
student s1;
s1.set_student("abc",99,99);
s1.show_student();
return 0;
}
using namespace std;
class student
{
public:
void show_student ()
{
cout<<"name"<<":"<<name<<endl;
cout<<"chinese"<<":"<<chinese<<endl;
cout<<"math"<<":"<<math<<endl;
}
void set_student (char*p,double a,double b)
{
name=new char[strlen(p)+1];
strcpy(name,p);
chinese=a;
math=b;
}
private:
char *name;
double chinese;
double math;
};
int main()
{
student s1;
s1.set_student("abc",99,99);
s1.show_student();
return 0;
}