主题:麻烦大家帮忙看哈此程序的不足!
建立基类building用于存一座楼的层数,房间数。。。!以及他的派生类house,office,.设计程序,并测试。
#include<iostream.h>
class building{
int f,r,area;
public:
fprint(int ff){
f=ff;
cout<<f<<endl;}
rprint(int rr){
r=rr;
cout<<r<<endl;}
areaprint(int ar){
area=ar;
cout<<area<<endl;}
};
class house:public building{
int s,b;
public:
sprint(int ss){s=ss;cout<<s<<endl;}
bprint(int bb){b=bb;cout<<b<<endl;}
};
class office:public building{
int m,t;
public:
tprint(int mm){m=mm;cout<<m<<endl;}
mprint(int tt){t=tt;cout<<t<<endl;}
};
void main()
{
house a;
a.areaprint(20);
office n;
n.areaprint(4);
}
#include<iostream.h>
class building{
int f,r,area;
public:
fprint(int ff){
f=ff;
cout<<f<<endl;}
rprint(int rr){
r=rr;
cout<<r<<endl;}
areaprint(int ar){
area=ar;
cout<<area<<endl;}
};
class house:public building{
int s,b;
public:
sprint(int ss){s=ss;cout<<s<<endl;}
bprint(int bb){b=bb;cout<<b<<endl;}
};
class office:public building{
int m,t;
public:
tprint(int mm){m=mm;cout<<m<<endl;}
mprint(int tt){t=tt;cout<<t<<endl;}
};
void main()
{
house a;
a.areaprint(20);
office n;
n.areaprint(4);
}