作者在 2009-05-16 15:34:18 发布以下内容
#include<iostream>
#include<iomanip>
#include<stdio.h>
using namespace std;
class vehicle
{
protected:
int carl;
double carw;
#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();
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();
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;
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();
void main()
{truck s(1,2,3,4);
s.truckshow ();
car a(5,6,7,8);
a.carshow();
}