> 知识 >

需要求3个长方柱的体积,请编写一个基于对象的程序.数据成员包括length长、width宽、height高.
要求用成员函数实现以下功能:
(1)由键盘分别输入3个长方柱的长、宽、高;
(2)计算长方柱的体积;
(3)输出3个长方柱的体积.
请编程序,上机调试并运行.

人气:231 ℃ 时间:2024-09-16 14:50:51
解答

#include
using namespace std;
class A
{
double lengh,width,height;
public:
A(){lengh=width=height=0;}
void input();
void output();
}
A::void input()
{
cout

推荐
猜你喜欢
© 2024 79432.Com All Rights Reserved.
电脑版|手机版