📄 sy7-2.cpp
字号:
#include "iostream.h"
class building
{
double length,width,price,area,total;
int floor;
public:
building(double a,double b,double c,int d)
{
length=a;
width=b;
price=c;
floor=d;
area=length*width*floor;
total=price*area;
}
void print();
};
void building::print()
{
cout<<"长度="<<length<<endl<<"宽度="<<width<<endl<<"楼层="<<floor<<endl<<"单价="<<price<<endl<<"面积="<<area<<endl<<"总价="<<total<<endl;
}
void main()
{
building build1(30,5,7000,10);
build1.print();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -