⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 d_rect.h

📁 这是数据结构和算法的国外经典书籍.清华大学出版社出版的<数据结构C++语言描述-应用模板库STL>陈君 译 英文名称是Data Structures with C++ Using STL.
💻 H
字号:
#ifndef RECTANGLE_CLASS
#define RECTANGLE_CLASS

// maintains measurement properties of a rectangle
class rectangle
{
	public:
		// constructor. initializes length and width
		rectangle(double len = 0.0, double wid  = 0.0): length(len), width(wid)
		{}

		// return the area (length * width)
		double area() const
		{ return length * width; }

		// return the perimeter (2 * (length + width))
		double perimeter() const
		{ return 2 * (length + width); }

		// change the dimensions of the rectangle to len and wid
		void setSides(double len, double wid)
		{
			length = len;
			width = wid;
		}

		// return the length of the rectangle
		double getLength() const
		{ return length; } 

		// return the width of the rectangle
		double getWidth() const
		{ return width; } 
	private:
		double length, width;
};

#endif   // RECTANGLE_CLASS

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -