| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3316 人关注过本帖
标题:请教下大家这段程序的错误在哪里?
只看楼主 加入收藏
家力掠
Rank: 2
等 级:论坛游民
帖 子:52
专家分:16
注 册:2015-6-28
结帖率:41.18%
收藏
已结贴  问题点数:5 回复次数:2 
请教下大家这段程序的错误在哪里?
程序代码:
#include <iostream>
#include <string>
using namespace std;
class Teacher
{
public:
    Teacher(string n, int ag, char s, string a, string te, string ti)
        :{age = ag; sex = s; tel = te; title = ti; addr = a; name = n; }
    void display();
protected:
    int age;
    char sex;
    string tel;
    string title;
    string addr;
    string name;
};

class Cadre: public Teacher
{
public:
    Cadre(string n, int ag, char s, string a, string te, string p, string ti)
        :Teacher(string n, int age, string a, string te, string ti) {post = p;}
protected:
    string post;
};

class Teacher_Cadre :public Cadre
{
public:
    void show();
    Teacher_Cadre(string n, int ag, char s, string a, string te, int w, string p, string ti)
        :Cadre(string n, int ag, char s, string a, string te, string p, string ti){wages = w; }
protected:
    int wages;
};

void Teacher_Cadre::show()
{
    display();
    cout << "wage:" << wages << endl;
    cout << "post:" << Cadre::post << endl;
}

void Teacher::display()
{
    cout << "name:" << name << endl;
    cout << "age:" << age << endl;
    cout << "sex:" << sex << endl;
    cout << "title" << title << endl;
    cout << "address:" << addr << endl;
    cout << "telephone:" << tel << endl;
}

int main(void)
{
    Teacher_Cadre tea("chenxingyin", 18'f', "YangqiaoRoad,fuzhou", "15386479123", 5600"teacher", "dr.");
    tea.show();

    return 0;
}
编译出来挺多错误的,又不知道怎么改,只能过来求助。
2016-01-31 17:20
家力掠
Rank: 2
等 级:论坛游民
帖 子:52
专家分:16
注 册:2015-6-28
收藏
得分:0 
不好意思发错板块了。求管理员帮助删除下。很抱歉

2016-01-31 17:21
天使梦魔
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:37
帖 子:564
专家分:2754
注 册:2007-8-29
收藏
得分:5 
你哪复制过来的,符号都是错的,自己都不看下先?
你想从中知道什么?

程序代码:
#include <iostream>
#include <string>
using namespace std;
class Teacher
{
public:
    Teacher(string n, int ag, char s, string a, string te, string ti){age = ag; sex = s; tel = te; title = ti; addr = a; name = n; }
    void display();
protected:
    int age;
    char sex;
    string tel;
    string title;
    string addr;
    string name;
};

class Cadre:public Teacher
{
public:
    Cadre(string n,int ag,char s,string a,string te,string p,string ti):Teacher(n, ag, s, a, te, ti){post = p;};
protected:
    string post;
};

class Teacher_Cadre :public Cadre
{
public:
    void show();
    Teacher_Cadre(string n, int ag, char s, string a, string te, int w, string p, string ti):Cadre(n, ag, s, a, te, p, ti){wages = w; }
protected:
    int wages;
};

void Teacher_Cadre::show()
{
    display();
    cout << "wage:" << wages << endl;
    cout << "post:" << Cadre::post << endl;
}

void Teacher::display()
{
    cout << "name:" << name << endl;
    cout << "age:" << age << endl;
    cout << "sex:" << sex << endl;
    cout << "title" << title << endl;
    cout << "address:" << addr << endl;
    cout << "telephone:" << tel << endl;
}

int main(void)
{
    Teacher_Cadre tea("chenxingyin", 18, 'f', "YangqiaoRoad,fuzhou", "15386479123", 5600,"teacher", "dr.");
    tea.show();
    return 0;
}
2016-01-31 18:20
快速回复:请教下大家这段程序的错误在哪里?
数据加载中...
 
   



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

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