• c++中string应该怎样用,应输入标识符是什么意思
  • 其它

#include<iostream> #include<string.h> using namespace std; class process { public:    virtual void print() = 0; }; class person :public process { private:    string name;    string gender;    int age;    person(string n, string g, int a)    {        name = n;        gender = g;        age = a;    }    virtual void print()    {        cout << "姓名:" << name << "性别:" << gender << "年龄:" << age << endl;    } }; class student :public person { public:    int id;    int score1;    int score2;    int score3;    person(int i, int s1, int s2, int s3)    {        id = i;        score1 = s1;        score2 = s2;        score3 = s3;    }    virtual void print()    {        cout << "学号:" << id << "语文成绩:" << score1 << "数学成绩:" << score2 << "英语成绩:" << score3 << endl;    } }; int main() {    person p("张三", "男", 20);    student s(19060102, 100, 99, 98);    process* pro1 = new person;    pro1->print();    process* pro2 = new student;    pro2->print();    system("pause");    return 0; } ```!![图片说明](https://img-ask.csdn.net/upload/202005/25/1590388783_830563.png) 有没有大佬看一下这个怎么改

  • 就几件    2020-05-26 10:28:20
  • 阅读 2516    收藏 0    回答 1
  • 邀请
  • 收藏
  • 分享
发送
登录 后发表评论
  • 51testing软件测试圈微信