من نمي تونم اين كدو كامپايل كنم كمكم كنيد
ميشه يكي به من در مورد تموم مشكلات اين كد بگه واقعا ممنون ميشم:11:
کد:
#include <iostream>
using namespace std;
class Point
{
public:
int GetX() const { return itsX; }
int GetY() const { return itsY; }
void SetX(int x) { itsX = x; }
void SetY(int y) { itsY = y; }
private:
int itsX;
int itsY;
};
class Rectangle
{
public:
Rectangle(int top,int bottom,int right,int left);
~Rectangle() {}
int GetTop() const { return itsTop; }
int GetBottom() const { return itsBottom; }
int GetRight() const { return itsRight; }
int GetLeft() const { return itsLeft; }
void SetTop(int top) { itsTop = top; }
void SetBottom(int bottom) { itsBottom = bottom; }
void SetRight(int right) { itsRight = right; }
void SetLeft(int left) { itsLeft = left; }
Point GetUpperRigt() const { return itsUpperRight; }
Point GetLowerRight() const { return itsLowerRight; }
Point GetUpperLeft() const { return itsUpperLeft; }
Point GetLowerLeft() const { return itsLowerLeft; }
void SetUpperRight(Point Location) { itsUpperRight = Location; }
void SetLowerRight(Point Location) { itsLowerRight = Location; }
void SetUpperLeft(Point Location) { itsUpperLeft = Location; }
void SetLowerLeft(Point Location) { itsLowerLeft = Location; }
int GetArea();
private:
int itsTop;
int itsBottom;
int itsRight;
int itsLeft;
int itsUpperRight;
int itsLowerRight;
int itsUpperLeft;
int itsLowerLeft;
};
#include "rect.hpp"
Rectangle::Rectangle(int top,int bottom,int right,int left)
{
itsTop = top;
itsBottom = bottom;
itsRight = right;
itsLeft = left;
itsUpperRight.GetX();
itsLowerRight.GetY();
itsUpperLeft.GetX();
itsLowerLeft.GetY();
}
int Rectangle::GetArea() const
{
int Weidth = itsRight - itsLeft;
int Height = itsTop - itsBottom;
Area = (Weidth * Height);
return Area;
}
int main()
{
Rectangle MyRectangle(20,100,50,80);
cout <<"Area = "<<MyRectangle.GetArea()<<endl;
cout <<"\nUpper left = "<<MyRectangle.GetUpperLeft.GetX()<<endl;
return 0;
}