当前位置:操作系统 > 安卓/Android >>

All rights reserved.

[cpp] 
/* 
* Copyright (c) 2013, 烟台大学计算机学院                     
* All rights reserved.                     
* 文件名称:test.cpp                     
* 作者:樊露露                    
* 完成日期:2013 年 5 月 27 日                     
* 版本号:v1.0                   
*                     
* 输入描述:无                     
* 问题描述:                  
* 程序输出:
* 问题分析:                    
* 算法设计:略                     
*/          
#include<iostream>  
#include<string>  
using namespace std; 
class Teacher 

public: 
    Teacher(string n,int a,char s,string ad,string t,string ti); 
    void display(); 
private: 
    string name; 
    int age; 
    char 易做图; 
    string add; 
    string tel; 
    string title; 
}; 
Teacher::Teacher(string n,int a,char s,string ad,string t,string ti):name(n),age(a),易做图(s),add(ad),tel(t),title(ti){ }   
void Teacher::display()   
{   
    cout<<"name:"<<name<<endl;   
    cout<<"age:"<<age<<endl;   
    cout<<"易做图:"<<易做图<<endl;   
    cout<<"title:"<<title<<endl;   
    cout<<"address:"<<add<<endl;   
    cout<<"tel:"<<tel<<endl;   
}   
 
class Cadre 

public: 
    Cadre(string n,int a,char s,string ad,string t,string p); 
    void display(); 
private: 
    string name; 
    int age; 
    char 易做图; 
    string add; 
    string tel; 
    string post; 
}; 
Cadre::Cadre(string n,int a,char s,string ad,string t,string p) 

    name=n; 
    age=a; 
    易做图=s; 
    add=ad; 
    tel=t; 
    post=p; 

void Cadre::display() 

    cout<<"name:"<<name<<endl;   
    cout<<"age"<<age<<endl;   
    cout<<"易做图:"<<易做图<<endl;   
    cout<<"post:"<<post<<endl;   
    cout<<"address:"<<add<<endl;   
    cout<<"tel:"<<tel<<endl; 

 
class Teacher_Cadre:public Teacher,public Cadre   

public: 
    Teacher_Cadre(string n,int a,char s,string ad,string t,string ti,string p,int w); 
    void show(); 
private: 
    string name; 
    int age; 
    char 易做图; 
    string add; 
    string tel; 
    int wages; 
}; 
Teacher_Cadre::Teacher_Cadre(string n,int a,char s,string ad,string t,string ti,string p,int w):Teacher(n,a,s,ad,t,ti),Cadre(n,a,s,ad,t,p),wages(w){ } 
void Teacher_Cadre::show() 

    Teacher::display(); 
    //cout<<"post:"<<Cadre::post<<endl;  
    cout<<"wages:"<<wages<<endl; 

 
int main() 

    Teacher_Cadre te_ca("Wang-li",50,'f',"135 Beijing Road,Shanghai","(021)61234567","president","prof.",1534);   
    te_ca.show( );   
    return 0;   

/*
* Copyright (c) 2013, 烟台大学计算机学院                    
* All rights reserved.                    
* 文件名称:test.cpp                    
* 作者:樊露露                   
* 完成日期:2013 年 5 月 27 日                    
* 版本号:v1.0                  
*                    
* 输入描述:无                    
* 问题描述:                 
* 程序输出:
* 问题分析:                   
* 算法设计:略                    
*/        
#include<iostream>
#include<string>
using namespace std;
class Teacher
{
public:
 Teacher(string n,int a,char s,string ad,string t,string ti);
 void display();
private:
 string name;
 int age;
 char s

补充:移动开发 , Android ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,