| 查看: 752 | 回复: 2 | ||
[求助]
运行以下程序,cuboid1的体积和cuboid2 的体积分别是多少? 已有1人参与
|
|
//Cuboid.h class Cuboid { public: void setCuboid(double l=2., double w=2., double h=2.); double getVolume(); private: double Length, double Width, double Heigth; }; //Cuboid.cpp #include "Cuboid.h" void Cuboid::setCuboid(double l, double w, double h){ Length = l; Width = w; Heigth = h; } double Cuboid::getVolume(){ return Length * Width * Heigth ; } #include <iostream> using namespace std; #include "Cuboid.h" void main(){ Cuboid cuboid1,cuboid2; cuboid1.setCuboid(); cuboid2.setCuboid (3, 4, 5); cout<<" cuboid1的体积=" << cuboid1.getVolume()<<endl<<endl; cout<<" cuboid2的体积=" << cuboid2.getVolume()<<endl<<endl; } |
» 猜你喜欢
咨询面上基金
已经有5人回复
影响面上的因素
已经有9人回复
8月时间戳变的,举个手。玩一下,释放压力
已经有11人回复
一个有机合成实验室都需要哪些设备?
已经有11人回复
求各位大神看下
已经有23人回复
面上再次挂了,太难了,躺也躺不了,倦也卷不过,小学校之殇!
已经有30人回复
2027年申博
已经有4人回复
好消息?这个有何含义???
已经有10人回复
【2027博士申请】纳米药物递送方向
已经有4人回复
UV压敏胶开发
已经有7人回复

2楼2014-07-16 11:31:10
zeppe
金虫 (小有名气)
- 应助: 15 (小学生)
- 金币: 3901.3
- 散金: 58
- 红花: 4
- 帖子: 205
- 在线: 254.1小时
- 虫号: 573594
- 注册: 2008-06-14
- 性别: GG
- 专业: 理论和计算化学
3楼2014-07-16 14:33:42










回复此楼