c++需要求3个长方柱体积
来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/09/25 10:39:11
c++需要求3个长方柱体积
#include <iostream>
using namespace std;
class cube
{
public:
void set();//构造函数
float com_volume();//计算体积
void disp();//输出体积
private:
float length;
float width;
float height;
};
void cube::set()
{
float l, w, h;
cout<<"下面进入长方柱的参数设置,单位:立方米"<<endl;
cout<<"请输入长方柱的长:";
cin>>l;
length=l;
cout<<"请输入长方柱的宽:";
cin>>w;
width=w;
cout<<"请输入长方柱的高:";
cin>>h;
height=h;
}
float cube::com_volume()
{
return length*width*height;
}
void cube::disp()
{
cout<<"此长方柱的体积为:"<<com_volume()<<"立方米"<<endl;
}
int main()
{
cube c[3];
for(int i=0; i<3; i++)
{
c[i].set() ;
c[i].disp();
cout<<endl;
}
return 0;
}
using namespace std;
class cube
{
public:
void set();//构造函数
float com_volume();//计算体积
void disp();//输出体积
private:
float length;
float width;
float height;
};
void cube::set()
{
float l, w, h;
cout<<"下面进入长方柱的参数设置,单位:立方米"<<endl;
cout<<"请输入长方柱的长:";
cin>>l;
length=l;
cout<<"请输入长方柱的宽:";
cin>>w;
width=w;
cout<<"请输入长方柱的高:";
cin>>h;
height=h;
}
float cube::com_volume()
{
return length*width*height;
}
void cube::disp()
{
cout<<"此长方柱的体积为:"<<com_volume()<<"立方米"<<endl;
}
int main()
{
cube c[3];
for(int i=0; i<3; i++)
{
c[i].set() ;
c[i].disp();
cout<<endl;
}
return 0;
}
c++需要求3个长方柱体积
需要求3个长方柱的体积,请编写一个基于对象的程序.数据成员包括length长、width宽、height高.
半圆柱体积公式
1个半圆柱体,高16cm,底的直径是10cm求表面积?
3个同样大小的圆柱体拼成一个高为30厘米的大圆柱体,表面积减少了40平方厘米,原来小圆柱体的体积是多少
3d max 布尔运算,怎么把多个物体同时进行布尔运算?或者把这个图里面 大圆柱体减去小圆柱体最快捷的方式
一个圆柱体长12dm,把它截成3个小圆柱体后,表面积增加12.56dm,原来的圆柱体的侧面积是多少平方分米?
【求助】柱体积怎么算?
半圆柱体积公式是什么?
把一个圆柱沿底面直径切成两个半圆柱体,每个半圆柱体的切面是200平方厘米,底面积是30平方厘米,求原来圆柱的表面积.
圆r=1.5,圆柱h=3,用scanf输入数据,结果保留小数点后两位数字.求圆周长、面积,球表面积,球体积,柱体积
求一根长方体水泥柱体积是1立方厘米高4厘米底面积是多少