帮帮忙!我这个程序错在哪里啊?????
c++吧
全部回复
仅看楼主
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
level 5
我改为Poin.h还是不行啊,
2007年10月24日 12点10分 3
level 5
但是为什么不能用呢???理论上有什么错误吗?
2007年10月24日 14点10分 5
1