| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 515 人关注过本帖
标题:我一直没找出来这程序的错误,求指点!
只看楼主 加入收藏
maxwell1st
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2014-12-19
结帖率:0
收藏
已结贴  问题点数:20 回复次数:2 
我一直没找出来这程序的错误,求指点!
#include<iostream>
using namespace std;
class plane
{
private:
    double aerofoil;
    double airframe;
    double empennage;
    double voyage;
    int passenger;
public:
    plane(double,double,double,double,int);
    virtual void display();
};
void plane::display()
{
  cout<<"\t"<<aerofoil<<"\t"<<airframe<<"\t"<<empennage<"\t"<voyage<<"\t"<<passenger;
}
plane::plane(double wing,double frame,double tail,double distance,int num)
{
  aerofoil=wing;
  airframe=frame;
  empennage=tail;
  voyage=distance;
  passenger=num;
}
class fighter:public plane
{
private:
    int missile;
public:
    fighter(double,double,double,double,int,int);
    void fight;
    void display();
};
fighter::fighter(double wing,double frame,double tail,double distance,
                 int num,int load_missile):plane(wing,frame,tail,distance,num)
{
    missile=load_missile;
}
void fighter::fight()
{
    cout<<"Fight!"<<endl;
}
void fighter::display()
{
    cout<<"This is a fighter!"<<endl;
    plane::display();
    cout<<"\t"<<missile<<endl;
}
class bomber:public plane
{
private:
    double bomb;
public:
    bomber(double,double,double,double,int,double);
    void atack();
    double getbomb();
    void display();
};
bomber::bomber(double wing,double frame,double tail,double distance,int num,double load_bomb):plane(wing,frame,tail,distance,num)
{
    bomb=load_bomb;
}
void bomber::atack()
{
    cout<<"Atack!"<<endl;
}
double bomber::getbomb()
{
    return bomb;
}
void bomber::display()
{
    cout<<"This is a bomber!"<<endl;
    plane::display();
    cout<<"\t"<<bomb<<endl;
}
class fighter_bomber:virtual public fighter,virtual public bomber
{
public:
    fighter_bomber(double,double,double,double,int,intdouble);
    void display();
};
void fighter_bomber::display()
{
    cout<<"This is a fighter_bomber!"<<endl;
    fighter::display();
    cout<<"\t"<<getbomb<<endl;
    fight();
    atack();
}

fighter_bomber::fighter_bomber(double wing,double frame,double tail,double distance,int num,int load_missile,double load_bomb):fighter
(wing,frame,tail,distance,num,load_missile),bomber(wing,frame,tail,distance,num,load_bomb)
{}
void main()
{
    fighter f(10.0,6.0,2.5,1800,1,8);
    f.display();
    bomber b(30,9,6,12000,12,6000);
    b.display();
    fighter_bomber fb(20,7,3.2,4000,2,6,2500);
    fb.display();
}
搜索更多相关主题的帖子: distance private display include public 
2014-12-19 12:54
wp231957
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:神界
等 级:贵宾
威 望:423
帖 子:13688
专家分:53332
注 册:2012-10-18
收藏
得分:10 
怎么发这种奇葩的代码  摆明了不想让别人帮你调试

DO IT YOURSELF !
2014-12-19 13:16
hao341202
Rank: 2
来 自:上海
等 级:论坛游民
威 望:1
帖 子:18
专家分:46
注 册:2014-12-23
收藏
得分:10 
(17)cout语法错误,自己看。
类,public:void fight()
void fighter_bomber::display()函数中cout中getbomb()
都是语法错误,你很不仔细啊。
2014-12-23 21:06
快速回复:我一直没找出来这程序的错误,求指点!
数据加载中...
 
   



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

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