C++利用结构
2024-08-31 23:43:05
#include <iostream>
using std::cout;
using std::endl; //定义结构
struct Box{
double length;
double width;
double height;
};
double volume(const Box& aBox);
int main(){
Box box={70.0,60.0,40.0};
double boxVolume=volume(box);
cout << "Size of box is:"<<endl
<< "length:"<<box.length<<endl
<<"width:"<<box.width<<endl
<<"height:"<<box.height<<endl;
cout <<"Voluem of box is:"<<boxVolume<<endl;
return 0;
}
//计算体积的函数
double volume(const Box& box){
return box.length*box.width*box.height;
}
版权声明:本文博主原创文章。博客,未经同意不得转载。
最新文章
- (转) 将ASP.NET Core应用程序部署至生产环境中(CentOS7)
- JS数组经典冒泡排序
- LibreOffice去重复数据
- transfer between javabean and map
- js中改变不同的div属性值的操作
- 万网云解析设置二级域名解析到同IP不同端口
- 20145317彭垚 java课程总结
- WinForm TreeView 三种状态
- Android Layout Binder(在线将XML中View find出来,生成java代码的工具)
- 如何在GitHub上生成ssh公钥并用NetBeans克隆项目
- Ubuntu 16.10的root默认密码设置
- Confluence 6 数据库 JDBC 驱动
- JAVA中循环删除list中元素的方法总结(同上篇)
- sql server 拼接字段
- k-近邻算法(KNN)
- October 27th, 2017 Week 43rd Friday
- ASP.net学习总结
- December 03rd 2016 Week 49th Saturday
- BZOJ 3123 【SDOI2013】 森林
- bzoj1011 遥远的行星
热门文章
- mysql常见故障诊断
- RISC-V工具链环境(基于Debian/Linux操作系统)
- 18、IIC总线驱动程序
- [Angular2 Form] patchValue, setValue and reset() for Form
- pppoe-环境下的mtu和mss
- [D3] Convert Dates to Numeric Values with Time Scales in D3 v4
- 用live555将内网摄像机视频推送到外网server,附源代码
- ajax跳转到新的jsp页面(局部刷新)
- MySQL建立双向主备复制server配置方法
- 数据局部性(data locality)