| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 572 人关注过本帖
标题:有错误,但是不会改,求帮助
取消只看楼主 加入收藏
hzj199603
Rank: 2
来 自:南京
等 级:论坛游民
帖 子:18
专家分:32
注 册:2015-3-29
结帖率:33.33%
收藏
 问题点数:0 回复次数:1 
有错误,但是不会改,求帮助
#include <iostream>
using namespace std;
class Teacher
{
    char name;
    int age;
    char sec;
    char address;
    int phone;
    char title;
public:
    void getna();
    void getag();
    void getse();
    void getad();
    void getph();
    void getti();
     void display();
};
class Cadre
{
    char name;
    int age;
    char sec;
    char address;
    int phone;
    char post;
public:
    void getna();
    void getag();
    void getse();
    void getad();
    void getph();
    void getpo();
    void display_1();
};
class Teacher_Cadre:public Teacher,protected Cadre
{
    int wages;
public :
    void getwa();
    void show();
};
void Teacher::getna()
{
    cout <<"putin the teacher's name:";
    cin>>name;
};
void Teacher::getag()
{
    cout <<"putin the teacher's age:";
    cin>>age;
};
void Teacher::getse()
{
    cout <<"putin the teacher's sec:";
    cin>>sec;
};
void Teacher::getad()
{
    cout <<"putin the teacher's address:";
    cin>>address;
};
void Teacher::getph()
{
    cout <<"putin the teacher's phone:";
    cin>>phone;
};
void Teacher::getti()
{
    cout <<"putin the teacher's title:";
    cin>>title;
};
void Teacher::display()
{
    cout<<"name:"<<name<<"age:"<<age<<"sec:"<<sec<<"title:"<<title<<"address:"<<address<<"phone:"<<phone;
};
void Cadre::getna()
{
    cout <<"putin the teacher's name:";
    cin>>name;
};
void Cadre::getag()
{
    cout <<"putin the teacher's age:";
    cin>>age;
};
void Cadre::getse()
{
    cout <<"putin the teacher's sec:";
    cin>>sec;
};
void Cadre::getad()
{
    cout <<"putin the teacher's address:";
    cin>>address;
};
void Cadre::getph()
{
    cout <<"putin the teacher's phone:";
    cin>>phone;
};
void Cadre::getpo()
{
    cout <<"putin the teacher's post:";
    cin>>post;
};
void Cadre::display_1()
{
    cout<<"post:"<<post;
};
void Teacher_Cadre::getwa()
{
    cout <<"putin the Teacher_Cadre'wages:";
    cin>>wages;
};
void Teacher_Cadre::show()
{
    display();
    display_1();
    cout<<"wages:"<<wages;
};
int main()
{
    Teacher_Cadre a;
    a.Teacher::getna;
    a.Teacher::getag;
    a.Teacher::getse;
    a.Teacher::getad;
    a.Teacher::getph;
    a.getpo;
    a.getti;
    a.getwa;
    a.show;
    return 0;
}
搜索更多相关主题的帖子: address display include public title 
2015-04-20 13:11
hzj199603
Rank: 2
来 自:南京
等 级:论坛游民
帖 子:18
专家分:32
注 册:2015-3-29
收藏
得分:0 
回复 2楼 诸葛欧阳
#include <iostream>
#include <string>
using namespace std;
class Teacher
{
    string name;
    int age;
    string sec;
    string address;
    int phone;
    string title;
public:
    void getna();
    void getag();
    void getse();
    void getad();
    void getph();
    void getti();
     void display();
};
class Cadre
{
    string name;
    int age;
    string sec;
    string address;
    int phone;
    string post;
public:
    void getna();
    void getag();
    void getse();
    void getad();
    void getph();
    void getpo();
    void display_1();
};
class Teacher_Cadre:public Teacher,public Cadre  //变成 class Teacher_Cadre:public Teacher,protected Cadre
{
    int wages;
public :
    void getwa();
    void show();
};
void Teacher::getna()
{
    cout <<"putin the teacher's name:";
    cin>>name;
}
void Teacher::getag()
{
    cout <<"putin the teacher's age:";
    cin>>age;
}
void Teacher::getse()
{
    cout <<"putin the teacher's sec:";
    cin>>sec;
}
void Teacher::getad()
{
    cout <<"putin the teacher's address:";
    cin>>address;
}
void Teacher::getph()
{
    cout <<"putin the teacher's phone:";
    cin>>phone;
}
void Teacher::getti()
{
    cout <<"putin the teacher's title:";
    cin>>title;
}
void Teacher::display()
{
    cout<<"name:"<<name<<"age:"<<age<<"sec:"<<sec<<"title:"<<title<<"address:"<<address<<"phone:"<<phone;
}
void Cadre::getna()
{
    cout <<"putin the teacher's name:";
    cin>>name;
}
void Cadre::getag()
{
    cout <<"putin the teacher's age:";
    cin>>age;
}
void Cadre::getse()
{
    cout <<"putin the teacher's sec:";
    cin>>sec;
}
void Cadre::getad()
{
    cout <<"putin the teacher's address:";
    cin>>address;
}
void Cadre::getph()
{
    cout <<"putin the teacher's phone:";
    cin>>phone;
}
void Cadre::getpo()/*class Teacher_Cadre:public Teacher,public Cadre变成 class Teacher_Cadre:public Teacher,protected Cadre                                                             这里为什么不让定义 */
{
    cout <<"putin the teacher's post:";
    cin>>post;
}
void Cadre::display_1()
{
    cout<<"post:"<<post;
}
void Teacher_Cadre::getwa()
{
    cout <<"putin the Teacher_Cadre'wages:";
    cin>>wages;
}
void Teacher_Cadre::show()
{
    display();
    display_1();
    cout<<"wages:"<<wages;
}
int main()
{
    Teacher_Cadre a;
    a.Teacher::getna();
    a.Teacher::getag();
    a.Teacher::getse();
    a.Teacher::getad();
    a.Teacher::getph();
    a.getpo();//class Teacher_Cadre:public Teacher,public Cadre变成 class Teacher_Cadre:public Teacher,protected Cadre之后,怎么改就对了?
    a.getti();
    a.getwa();
    a.show();
    return 0;
}
谢谢
2015-04-20 16:41
快速回复:有错误,但是不会改,求帮助
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022394 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved