第十二周任务2

01./* (程序头部注释开始)       
02.* 程序的版权和版本声明部分       
03.* Copyright (c) 2011, 烟台大学计算机学院学生        
04.* All rights reserved.       
05.* 文件名称:                                     
06.* 作    者:   王明星                      
07.* 完成日期:   2012   年  4 月 16 日       
08.* 版 本 号:
09.* 记录:                
10.*对任务及求解方法的描述部分       
11.* 输入描述:       
12.* 问题描述:实现分数类中的<<和>>运算符重载,实现分数的输入和输出      
13.1* 程序头部的注释结束       
14.*/      
15.#include <iostream>   
16.#include <string>   
17.using namespace std;  
18.class Teacther  
19.{  
20.public:  
21.    Teacther(string t,string nam,int n, char m,string p,string s):title(t),name(nam),age(n),sex(m),place(p),phone(s){}  
22.    void display();  
23.  
24.protected:  
25.    string title;  
26.    string name;  
27.    int age;  
28.    char sex;  
29.    string place;  
30.    string phone;  
31.};  
32.void Teacther::display()  
33.{  
34.  
35.    cout<<"姓名:"<<name<<endl;  
36.    cout<<"年龄:"<<age<<endl;  
37.    cout<<"性别:"<<sex<<endl;  
38.    cout<<"住址:"<<place<<endl;  
39.    cout<<"电话:"<<phone<<endl;  
40.    cout<<"职称:"<<title<<endl;  
41.}  
42.class Cadre  
43.{  
44.public:  
45.    Cadre(string a,string b,int c,char d,string e,int f,string h):title(a),name(b),age(c),sex(d),place(e),phone(f),post(h){}  
46.  
47.protected:  
48.    string title;  
49.    string name;  
50.    int age;  
51.    char sex;  
52.    string place;  
53.    int phone;  
54.    string post;  
55.};  
56.class Teacther_Cadre:public Teacther,public Cadre  
57.{  
58.public:  
59.    Teacther_Cadre(string t,string nam,int n, char m,string p,string s,string a,string b,int c,char d,string e,int f,string h,int q):Teacther(t,nam,n,m,p,s),Cadre(a,b,c,d,e,f,h){wages=q;}  
60.    void show();  
61.  
62.    int wages;  
63.};  
64.void Teacther_Cadre::show()  
65.{  
66.    display();  
67.    cout<<"职务:"<<post<<endl;  
68.    cout<<"工资:"<<wages<<endl;  
69.}  
70.void main()  
71.{  
72.    Teacther_Cadre t("jiaoshou","wangmingxing", 21,'f',"linyi","18253591884","jiaoshou", "wangmingxing", 21,'f'," lingyi",18253591884,"jiaoshi",20000);  
73.    t.show();  
74.    system("pause");  
75.}  


上机感言:哈哈,还得继续努力呀!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值