// Box.cpp Box class member function definitions
#include <iostream>
#include "Box.h"
using std::cout;
using std::endl;
// Constructor
Box::Box(double lvalue, double wvalue, double hvalue) :
length(lvalue), width(wvalue), height(hvalue) {
cout << "Box constructor called" << endl;
// Ensure positive dimensions
if(length <= 0.0)
length = 1.0;
if(width <= 0.0)
width = 1.0;
if(height <= 0.0)
height = 1.0;
}
// Function to calculate the volume of a box
double Box::volume() {
return length * width * height;
}
没有合适的资源?快使用搜索试试~ 我知道了~
Box_class.rar_box
共3个文件
cpp:1个
h:1个
o:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 8 浏览量
2022-09-24
13:05:22
上传
评论
收藏 2KB RAR 举报
温馨提示
这是一个Box的源码。Function to calculate the volume of a box。
资源推荐
资源详情
资源评论
收起资源包目录
Box_class.rar (3个子文件)
Box.cpp 588B
Box.o 2KB
Box.h 717B
共 3 条
- 1
资源评论
局外狗
- 粉丝: 67
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功