#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++小程序(五)--根据坐标求矩阵面积
最新推荐文章于 2022-03-20 17:07:26 发布
这篇博客是Slience的原创,探讨如何使用C++编程来根据坐标求解矩阵的面积。博客鼓励读者自我提升,指出改变自身比改变世界更重要,以此激发读者的编程热情。
摘要由CSDN通过智能技术生成