我的第2个程序 别表扬我啊

作者在 2009-05-16 15:34:18 发布以下内容
#include<iostream>
#include<iomanip>
#include<stdio.h>
using namespace std;
class vehicle
{
protected:
 int carl;
 double carw;
};
class truck:private vehicle
{double zks;
 double zkw;
public:
 truck(int x,double y,int m,double n);
 void truckshow();
 

};
truck::truck(int x,double y,int m,double n)
{carl=x;
carw=y;
zks=m;
zkw=n;
 

}
void truck::truckshow ()
{
 cout<<"卡车轮数  "<<carl<<"  "<<"卡车重量  "<<carw<<"  "<<"卡车载客数  "<<zks<<"  "<<"卡车载客重量  "<< zkw<<endl;
 
}
class car:private vehicle
{double zks;
 double zkw;
public:
 car(int x,double y,int m,double n);
 void carshow();
 
 
 
};
car::car(int x,double y,int m,double n)
{carl=x;
carw=y;
zks=m;
zkw=n;
 

}
void car::carshow ()
{
 cout<<"轿车车轮数 " <<carl<<"  "<<"轿车重量  "<<carw<<"  "<<"载客数  "<<zks<<"  "<<"载客重量  "<< zkw<<endl;
 
}
void main()
{truck s(1,2,3,4);
s.truckshow ();
car a(5,6,7,8);
a.carshow();

}
默认分类 | 阅读 2525 次
文章评论,共0条
游客请输入验证码
文章分类
最新评论