作业帮 > 综合 > 作业

需要求3个长方柱的体积,请编写一个基于对象的程序.数据成员包括length长、width宽、height高.

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/09 06:06:52
需要求3个长方柱的体积,请编写一个基于对象的程序.数据成员包括length长、width宽、height高.
要求用成员函数实现以下功能:
(1)由键盘分别输入3个长方柱的长、宽、高;
(2)计算长方柱的体积;
(3)输出3个长方柱的体积.
请编程序,上机调试并运行.
#include
using namespace std;
class A
{
double lengh,width,height;
public:
A(){lengh=width=height=0;}
void input();
void output();
}
A::void input()
{
cout