参考程序: #include iostream // 编译预处理命令 using namespace std; // 使用命名空间std // 声明员工类 class Employee { protected: // 保护成员 int num; // 编号 char name[16]; // 姓名 float basicSalary; // 基本工资 float prize; // 奖金 public: // 公有函数 Employee(int n, char nm[], float bs, float p): // 构造函数 num(n), basicSalary(bs), prize(p) { strcpy(name, nm); } void Show() const // 输出基本信息 { cout 编号: num endl; cout 姓名: name endl; cout 基本工资: basicSalary 元 endl; cout 奖金: prize 元 endl; } void ShowSalary() const // 输出实发工资 { cout 实发工资: basicSalary + prize 元
原创力文档

文档评论(0)