#include<iostream>
using namespace std;
class Rectangle//构造Rectangle类
{
public: //外部接口
Rectangle(int top,int left,int bottom,int right);//构造函数
~Rectangle() {} //析构函数
int GetTop() const { return itsTop; }
int GetLeft() const { return itsLeft; }
int GetBottom() const { return itsBottom; }
int GetRight() const { return itsRight; }
void SetTop(int top) { itsTop=top; }
void SetLeft(int left) { itsLeft=left; }
void SetBottom(int bottom) { itsBottom=bottom; }
void SetRight(int right) { itsRight=right; }
int GetArea() const;
private: //私有部分
int itsTop,itsLeft,itsBottom,itsRight;
};
Rectangle::Rectangle(int top,int left,int bottom,int right)
{
itsTop=top;
itsLeft=left;
itsBottom=bottom;
itsRight=right;
}
int Rectangle::GetArea() const
{
int Width=itsRight-itsLeft;
int Height&#
每日一个C++小程序(五)--根据坐标求矩阵面积
最新推荐文章于 2020-06-16 20:11:34 发布