早教吧作业答案频道 -->其他-->
C++题目计算3个长方体体积#includeusingnamespacestd;classBox{private:floatlength;floatwidth;floatheight;public:Box(floatl,floatw,floath);Input();Count();};Box::Box(floatl,floatw,floath){length=l;width=w;height=h;}Box
题目详情
C++题目 计算3个长方体体积
#include
using namespace std;
class Box
{
private:
float length;
float width;
float height;
public:
Box(float l,float w,float h);
Input();
Count();
};
Box::Box(float l,float w,float h)
{ length=l;
width=w;
height=h;
}
Box::Input()
{cin>>length>>width>>height;
}
Box::Count()
{
return length*width*height;
}
int main()
{ Box b1,b2,b3;
cout
#include
using namespace std;
class Box
{
private:
float length;
float width;
float height;
public:
Box(float l,float w,float h);
Input();
Count();
};
Box::Box(float l,float w,float h)
{ length=l;
width=w;
height=h;
}
Box::Input()
{cin>>length>>width>>height;
}
Box::Count()
{
return length*width*height;
}
int main()
{ Box b1,b2,b3;
cout
▼优质解答
答案和解析
#include
using namespace std;
class Box
{
private:
float length;
float width;
float height;
public:
Box (float l, float w, float h);
void Input(); // 需要返回类型
float Count(); // 需要返回值
};
Box::Box (float l, float w, float h)
{
length = l;
width = w;
height = h;
}
void Box::Input() // 需要返回类型
{
cin >> length >> width >> height;
}
float Box::Count() // 需要返回值
{
return length * width * height;
}
int main()
{
Box b1(1, 2, 3); // 构造器需要参数
Box b2(2, 2, 2);
Box b3(3, 2, 1);
cout
using namespace std;
class Box
{
private:
float length;
float width;
float height;
public:
Box (float l, float w, float h);
void Input(); // 需要返回类型
float Count(); // 需要返回值
};
Box::Box (float l, float w, float h)
{
length = l;
width = w;
height = h;
}
void Box::Input() // 需要返回类型
{
cin >> length >> width >> height;
}
float Box::Count() // 需要返回值
{
return length * width * height;
}
int main()
{
Box b1(1, 2, 3); // 构造器需要参数
Box b2(2, 2, 2);
Box b3(3, 2, 1);
cout
看了C++题目计算3个长方体体积#...的网友还看了以下:
英语单词填空(组成单词)1)d.l.e.d.m.i2)l.e.p.o.i.ee3)u.y.g.o. 2020-04-25 …
(1)操作、观察:任意画⊙O,在⊙O内任取一点P(不为圆心),过点P直线l,交⊙O于点A、B.若直 2020-05-13 …
如图,已知直线l与⊙O相离,OA⊥l于点A,OA=5,OA与⊙O相交于点P,点B在⊙O上,BP的延 2020-07-13 …
(2014•安徽二模)如图,在水平面上有一弹簧,其左端与墙壁相连,O点为弹簧原长位置,O点左侧水平 2020-07-21 …
如图,直线l与O相离,过点O作OA⊥l,垂足为A,OA交O于点B,点C在直线l上,连接CB并延长交 2020-07-21 …
如图,已知直线l与O相离,OA⊥l于点A,OA与O相交于点P,点B为O上一点,BP的延长线交直线l 2020-07-26 …
如图,已知直线l与O相离,OA⊥l于点A,OA=5,OA与O相交于点P,AB与O相切于点B,BP的 2020-07-26 …
如图,已知直线l与O相离,OA⊥l于点A,OA=10,OA与O相交于点P,AB与O相切于点B,BP 2020-07-31 …
如图,已知直线l与⊙O相离,OA⊥l于点A,交⊙O于点P,点B是⊙O上一点,连接BP并延长,交直线l 2021-01-02 …
英文单词分类填空动物类1.O()t()p()s2.k()t()e()3.l()b()t()r4.a( 2021-02-05 …