第11周项目4教师兼干部类

/*
*Copyright (c) 2016,烟台大学计算机学院
*All rights reserved.
*文件名称 :
*作    者 : 刘云
*完成日期 : 2016年5月8号
*版 本 号 : v6.0
*
*问题描述 :  教师兼干部类
*输入描述 :   无
*程序输出 :
*/

#include<iostream>
#include<cstring>
using namespace std;
class Teacher
{
public:
    Teacher(string nam,int a,char c,string ad,long phone,string zhicheng):name(nam),age(a),sex(c),addr(ad),tell(phone),title(zhicheng){}
    void Teacherdisplay();
    string name;
    int age;
    char sex;
    string addr;
    long tell;
    string title;
};
void Teacher::Teacherdisplay()
{
    cout<<"姓名:"<<name<<endl;
    cout<<"年龄:"<<age<<endl;
    cout<<"性别:"<<sex<<endl;
    cout<<"地址:"<<addr<<endl;
    cout<<"电话号码:"<<tell<<endl;
    cout<<"职称:"<<title<<endl;
}
class Cardre
{
public:
    Cardre(string nam,int a,char c,string ad,long phone,string po):name(nam),age(a),sex(c),addr(ad),tell(phone),post(po){}
    void Cardredisplay();
    string getpost(){return post;}
    string name;
    int age;
    char sex;
    string addr;
    long tell;
    string post;
};
void Cardre::Cardredisplay()
{
    cout<<"姓名:"<<name<<endl;
    cout<<"年龄:"<<age<<endl;
    cout<<"性别:"<<sex<<endl;
    cout<<"地址:"<<addr<<endl;
    cout<<"电话号码:"<<tell<<endl;
    cout<<"职务:"<<post<<endl;
}
class Teacher_Cardre:public Teacher,public Cardre
{
public:
    Teacher_Cardre(string nam,int a,char c,string ad,long phone,double wage,string zhicheng,string po):Teacher(nam,a,c,ad,phone,zhicheng),Cardre(nam,a,c,ad,phone,po),wages(wage){}
    void showTeacher_Cardre();
    string name;
    int age;
    char sex;
    string addr;
    long tell;
    double wages;
};
void Teacher_Cardre::showTeacher_Cardre()
{
    Teacherdisplay();
    cout<<"职务:"<<getpost()<<endl;
    cout<<"工资:"<<wages<<endl;
}
int main()
{
    Teacher_Cardre tc("小明",'f',23,"山东省烟台市海港街道",15263642506,2000,"历史老师","级部主任");
    tc.showTeacher_Cardre();
    return 0;
}

运行结果:


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值