第十一周项目2 - 职员有薪水了
2014-05-06 15:21
295 查看
/*烟台大学计算机学院学生 *All right reserved. *文件名称*烟台大学计算机学院学生 *作者:初瑞 *完成日期:2014年5月6日 *版本号:v1.0 *对任务及求解方法的描述部分:项目2 - 职员有薪水了 *我的程序:*/ #include <iostream> using namespace std; class CPerson { protected: string m_szName; string m_szId; int m_nSex;//0:women,1:man int m_nAge; public: CPerson(string name,string id,int sex,int age): m_szName(name),m_szId(id),m_nSex(sex),m_nAge(age){}; void Show1() { cout<<"姓名"<<m_szName<<endl; cout<<"身份证号码"<<m_szId<<endl; cout<<"性别"<<m_nSex<<endl; cout<<"年龄"<<m_nAge<<endl; } ~CPerson() { }; }; class CEmployee:public CPerson { private: string m_szDepartment; double m_Salary; public: CEmployee(string name,string id,int sex,int age,string department,double salary):CPerson(name,id,sex,age) { m_szDepartment= department; m_Salary=salary; }; void Show2() { Show1(); cout<<"部门"<<m_szDepartment<<endl; cout<<"工资"<<m_Salary<<endl; } ~CEmployee() { }; }; int main() { string name,id,department; int sex,age; double salary; cout<<"input employee's name,id,sex(0:women,1:man),age,department,salary:\n"; cin>>name>>id>>sex>>age>>department>>salary; CEmployee employee1(name,id,sex,age,department,salary); employee1.Show2(); return 0; }
运算结果:
心得体会:仿照项目一写出的项目二
相关文章推荐
- 第十一周 项目二:(1) 职员有薪水了
- 2015年第十一周项目二:职员有薪水了(1)
- 第十一周项目二——职员有薪水了(2)
- 第十一周项目2 - 职员有薪水了
- 第十一周项目2 - 职员有薪水了
- 第十一周上机项目二职员有薪水了
- 第十一周项目2-职员有薪水了
- 第十一周项目:职员有薪水了(1)
- 第十一周 项目2-职员有薪水了(2)
- 第十一周 项目2 - 职员有薪水了(2)
- 第十一周项目二 职员有薪水了
- 第十一周项目2-职员有薪水了(扩展)
- 第十一周 课后实践:项目二——职员有薪水了(2)
- 第十一周项目二 职员有薪水了(2)
- 15第十一周项目二——职员有薪水了(1)
- 第十一周 项目二(2):职员有薪水了
- 第十一周 项目2--职员有薪水了
- 第十一周项目三 职员有薪水了(派生类,含深复制)
- 第十一周上机实践项目2——职员有薪水了(1)
- 第十一周项目2——(1)职员有薪水了