/*copyright (c) 2016, Yantai University School of computer *all rights reserved. * File Name: * Author: Tian Zhiwei * Completion date: May 10, 2016 * Version number: v1.0 * * Problem Description: Teacher and Cadre class * Input Description: * Program output: Teacher information */#include <iostream>u Sing namespace Std;class teacher{protected:int age; String name; String addr; string title; string sex; int tel;public:teacher (int a,string n,string ad,string t,string s,int te); void display ();}; Teacher::teacher (int a,string n,string ad,string t,string s,int te) {age=a; Name=n; Addr=ad; title=t; Sex=s; Tel=te;} void Teacher::d isplay () {cout<< "Age:" <<age<<endl; cout<< "Name:" <<name<<endl; cout<< "Address:" <<addr<<endl; cout<< "Account:" <<title<<endl; cout<< "Sex for:" <<sex<<endl; cout<< "Phone:" <<TEL<<ENDL;} Class Cadre{protected:int age; String name; String addr; String post; string sex; int tel;public:cadre (int a,string n,string ad,string p,string s,int te);}; Cadre::cadre (int a,string n,string ad,string p,string s,int te) {age=a; Name=n; Addr=ad; post=p; Sex=s; Tel=te;} Class Teacher_cadre:public teacher,public cadre{private:double wages;public:teacher_cadre (int a,string n,string AD , String p,string t,string s,int te,double wa); void display ();}; Teacher_cadre::teacher_cadre (int a,string n,string ad,string p,string t,string s,int te,double wa): Teacher (A,n,ad,t,s, TE), cadre (a,n,ad,p,s,te), Wages (WA) {}void teacher_cadre::d isplay () {Teacher::d isplay (); cout<< "Position:" <<post<<endl; cout<< "Commission for:" <<WAGES<<ENDL;} int main () {Teacher_cadre F1 (+, "Laowang", "Shandongsheng Zhaoyuanshi", "Qingjiegong", "Tiyu", "Woman", 10086,250); F1.display ();}
Program run:
11th Week Fourth project--Teacher cadre category