#include<iostream>
#include<string.h>
using namespace std;
class Person {
public:
Person() {}
Person(const char* name, int id){
this->id = id;
strcpy_s(this->name, 81, name); }
~Person() {};
谁能帮我看看是哪里有问题吗?
void Display() {
cout << name << " " << id << " " << endl; }
protected:
char name[81];
int id;
};
class CollegeStu:public Person {
public:
CollegeStu() {}
CollegeStu(const char* major,double score):Person(name,id)
{ this->score =score ;
strcpy_s(this->major, 81, major);
}
void Display() {
cout <<name<<" "<<id<<" "<< major << " " << score << endl;
}
private:
char major[81];
double score;
};
int main()
{
char name[81], major[81];
int id;
double score;
cin >> name >> id >> major >> score;
CollegeStu cs(name, id, major, score);
cs.Display();
return 0;
}