不挂科搜题免费

问题:

【编程题】定义一个学生类student,它含有私有数据成员:学号、姓名、年龄、成绩及公有成员函数:构

答案:

#include #include class student { private: int num; char name[10]; int age; int score; public: student(int x,char y[],int z,int m ); void set(int x,char y[],int z,int m); void show(); }; inline student::student(int x,char y[],int z,int m) { num=x; strcpy(name,y); age=z; score=m; } inline void student::set (int x,char y[],int z,int m) { num=x; strcpy(name,y); age=z; score=m; } void student::show() { cout