C++程序自动停止运行,求解,急急!!
#include<iostream>#include<string>usingnamespacestd;//===============================...
#include<iostream>
#include<string>
using namespace std;
//============================================
class Tool{
protected:
string name;
string number;
int busload;
double speed;
string type;
public:
Tool(string na,string nu,int b,double s,string t){
name=na;
number=nu;
busload=b;
speed=s;
type=t;
}
void Start(){
cout<<"Start!"<<'\n'
<<"name:"<<name<<'\n'
<<"number:"<<number<<'\n'
<<"busload:"<<busload<<'\n'
<<"speed:"<<speed<<'\n'
<<"type:"<<type<<'\n';
}
~Tool(){
cout<<"stop!"<<endl;
}
};
//=============================================
class Airplane:public Tool{
public:
Airplane(string na,string nu,int b,double s,string t):Tool(na,nu,b,s,t){};
~Airplane(){cout<<"stop"<<endl;
}
};
//
void main(){
Tool a("交通工具","0",0,0,0);
a.Start();
Airplane b("飞机","A407",100,5000,"未知");
b.Start();
} 展开
#include<string>
using namespace std;
//============================================
class Tool{
protected:
string name;
string number;
int busload;
double speed;
string type;
public:
Tool(string na,string nu,int b,double s,string t){
name=na;
number=nu;
busload=b;
speed=s;
type=t;
}
void Start(){
cout<<"Start!"<<'\n'
<<"name:"<<name<<'\n'
<<"number:"<<number<<'\n'
<<"busload:"<<busload<<'\n'
<<"speed:"<<speed<<'\n'
<<"type:"<<type<<'\n';
}
~Tool(){
cout<<"stop!"<<endl;
}
};
//=============================================
class Airplane:public Tool{
public:
Airplane(string na,string nu,int b,double s,string t):Tool(na,nu,b,s,t){};
~Airplane(){cout<<"stop"<<endl;
}
};
//
void main(){
Tool a("交通工具","0",0,0,0);
a.Start();
Airplane b("飞机","A407",100,5000,"未知");
b.Start();
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询