chapter 9
来源:互联网 发布:程序授权系统源码 编辑:程序博客网 时间:2024/06/04 19:57
Ex1,
#include<iostream>using namespace std;class Rectangle{public:double width_, height_;Rectangle(){width_ = 4.0;height_ = 40.0;}Rectangle(double width, double height) :width_{ 3.5 }, height_{ 35.9 }{width_ = width;height_ = height;}double getArea(){return width_*height_;}double getPerimeter(){return 2 * (width_ + height_);}};int main(){Rectangle myRectangle;cout << myRectangle.width_ << endl;cout << myRectangle.height_ << endl;cout << myRectangle.getArea() << endl;cout << myRectangle.getPerimeter() << endl;Rectangle myRectangle1;myRectangle1.width_ = 1;myRectangle1.height_ = 2;cout << myRectangle1.getArea() << endl;cout << myRectangle1.getPerimeter() << endl;return 0;}
阅读全文
0 0
- chapter 9
- Programming Ruby-chapter 9
- Chapter 9 Compatibility Testing
- Chapter 9 接口
- Chapter 9 Sequential Containers
- Chapter 9 : Miscellany
- Chapter 9 进程关系
- chapter 9 顺序容器
- chapter 9Coroutines
- note_practical_c_programming chapter 9
- chapter 9 ICMP
- 记录锁(Chapter 9)
- Matlab学习 Chapter 9
- Chapter 9 Sequential Containers
- Chapter 9-MaxHeap
- Chapter 9-01
- Chapter 9-02
- Chapter 9-03
- 线性代数(二)
- Linux C 获取格式化的日期时间
- kafka的线程模型之二
- 八种数据类型
- Evaluate Division(LeetCode 339)
- chapter 9
- java面向对象
- oracle默认值添加方法
- Android 中.aar文件生成方法与用法
- 冒泡
- 最小生成树
- 凸优化,含有支撑超平面
- HTTP状态码
- java web应用启动和销毁监听