按照你的要求大致写了个,希望能帮到你
// Test.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include
#include
using namespace std;
class Teacher
{
public:
Teacher(string na, int ag, char se, string ad, string te, string ti);
void display();
protected:
string name;
int age;
char sex; //F or M
string addr;
string tel;
string title; //职称
};
class Cadre
{
public:
Cadre(string na, int ag, char se, string ad, string te, string po);
void display();
protected:
string name;
int age;
char sex;
string addr;
string tel;
string post; //职务
};
class Teacher_Cadre:public Teacher, public Cadre
{
public:
Teacher_Cadre(string na, int ag, char se, string ad, string te, string ti, string post, int wa);
void show();
protected:
int wages;//工资
};
Teacher::Teacher(string na, int ag, char se, string ad, string te, string ti)
{
name = na;
age = ag;
sex = se;
addr = ad;
tel = te;
title = ti;
}
void Teacher::display()
{
cout<<"name:"<
Cadre::Cadre(string na, int ag, char se, string ad, string te, string po)
{
name = na;
age = ag;
sex = se;
addr = ad;
tel = te;
post = po;
}
void Cadre::display()
{
cout<<"name:"<
Teacher_Cadre::Teacher_Cadre(string na, int ag, char se, string ad, string te, string ti, string po, int wa)
:Teacher(na, ag, se, ad, te, ti),Cadre(na, ag, se, ad, te, po)
{
wages = wa;
}
void Teacher_Cadre::show()
{
Teacher::display();
cout<<"post"<
}
int _tmain(int argc, _TCHAR* argv[])
{
Teacher t("Jack", 24, 'M', "BeiJing", "13412345678", "讲师");
t.display();
Cadre c("Lucy", 26, 'F', "Shanghai", "18912345678", "3500");
c.display();
Teacher_Cadre tc("Smith", 28, 'M', "Wuhan", "13417896678", "教授", "管理员", 4000);
tc.show();
return 0;
}
Kao,至少需要300行代码
你给我200分我还不愿意给你写呢,一点诚意也没有,打发要饭的啊
给我50块钱,我给你写!
这个是你的课程设计吧?想得太简单了哦
eam>
using namespace std;
void back(int a);
int main()
{
int a;
cout<<"请输入一个三位整数:";
cin>>a;
cout< back(a);
return 0;
}
void back(int a)
{
cout< a=a/10;
cout< a=a/10;
cout< cout<