8-3.cpp
来自「为初学者提供的最佳的C++程序设计源程序库」· C++ 代码 · 共 27 行
CPP
27 行
#include<iostream.h>
class box
{
double line,width,heigth;
double volume;
public:
box(double a,double b,double c);
void vol();
};
box::box(double a,double b,double c)
{
line=a;
width=b;
heigth=c;
volume=line*heigth;
}
void box::vol()
{
cout<<"Volume is:"<<volume<<"\n";
}
main()
{
box x(3.4,4.5,8.5),y(2.0,4.0,6.0);
x.vol();
y.vol();
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?