level 5
曾经沧海千秋梦
楼主
#include
class Point{public:void SetX(int x){itsX=x;}void SetY(int y){itsY=y;}int GetX()const{return itsX;}int GetY()const{return itsY;}private:int itsX;int itsY;};class Poin{public:Poin(int top,int left,int bottom,int right);~Poin(){};int GetTop()const{return itsTop;}int GetLeft()const{return itsLeft;}int GetBottom()const{return itsBottom;}int GetRight()const{return itsRight;}Point GetUpperLeft()const{return itsUpperLeft;}Point GetLowerLeft()const{return itsLowerLeft;} Point GetUpperRight()const{return itsUpperRight;}Point GetLowerRight()const{return itsLowerRight;}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:Point itsUpperLeft;Point itsUpperRight;Point itsLowerLeft;Point itsLowerRight;int itsTop;int itsLeft;int itsBottom;int itsRight;};#include"Poin.hpp"Poin::Poin(int top,int left,int bottom,int right){itsTop=top;itsLeft=left;itsBottom=bottom;itsRight=right;itsUpperLeft.SetX(left);itsUpperLeft.SetY(top);itsUpperRight.SetX(right);itsUpperRight.SetY(top);itsLowerLeft.SetX(left);itsLowerLeft.SetY(bottom);itsLowerRight.SetX(right);itsLowerRight.SetY(bottom);}int Poin::GetArea()const{int Width=itsRight-itsLeft;int Height=itsTop-itsBottom;return (Width*Height);}int main(){Poin MyRectangle(100,20,50,80);int Area=MyRectangle.GetArea();std::cout<<"Area: "<
2007年10月24日 10点10分
1
class Point{public:void SetX(int x){itsX=x;}void SetY(int y){itsY=y;}int GetX()const{return itsX;}int GetY()const{return itsY;}private:int itsX;int itsY;};class Poin{public:Poin(int top,int left,int bottom,int right);~Poin(){};int GetTop()const{return itsTop;}int GetLeft()const{return itsLeft;}int GetBottom()const{return itsBottom;}int GetRight()const{return itsRight;}Point GetUpperLeft()const{return itsUpperLeft;}Point GetLowerLeft()const{return itsLowerLeft;} Point GetUpperRight()const{return itsUpperRight;}Point GetLowerRight()const{return itsLowerRight;}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:Point itsUpperLeft;Point itsUpperRight;Point itsLowerLeft;Point itsLowerRight;int itsTop;int itsLeft;int itsBottom;int itsRight;};#include"Poin.hpp"Poin::Poin(int top,int left,int bottom,int right){itsTop=top;itsLeft=left;itsBottom=bottom;itsRight=right;itsUpperLeft.SetX(left);itsUpperLeft.SetY(top);itsUpperRight.SetX(right);itsUpperRight.SetY(top);itsLowerLeft.SetX(left);itsLowerLeft.SetY(bottom);itsLowerRight.SetX(right);itsLowerRight.SetY(bottom);}int Poin::GetArea()const{int Width=itsRight-itsLeft;int Height=itsTop-itsBottom;return (Width*Height);}int main(){Poin MyRectangle(100,20,50,80);int Area=MyRectangle.GetArea();std::cout<<"Area: "<