1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
class my_point
{
public:
my_point();
my _point (int,int);
void print()const;
int getX ()const;
int getY ()const;
void setX (int);
void setY (int);
double distance (my_point);
//new methods to add
void moveNE (int,int);
bool inFirstQuadrant()const;
bool inSecondQuadrant ()const;
bool inThirdQuadrant ()const;
bool inFourthQuadrant ()const;
bool inSameQuadrant (my_point)cosnt;
double signedArea (my_point,my_point) const;
double triangleArea (my_point,my_point)const;
bool leftTurn (my-point,my_point)cosnt;
bool collinear (my_point,my_point)const;
bool rightTurn (my_point,my_point)const;
private:
int xCoord;
int yCoord;
};
void my_point::moveNE(int n1, int n2)
//
//
class my_point
{
public:
my_point();
my _point (int,int);
void print()const;
int getX ()const;
int getY ()const;
void setX (int);
void setY (int);
double distance (my_point);
//new methods to add
void moveNE (int,int);
bool inFirstQuadrant()const;
bool inSecondQuadrant ()const;
bool inThirdQuadrant ()const;
bool inFourthQuadrant ()const;
bool inSameQuadrant (my_point)cosnt;
double signedArea (my_point,my_point) const;
double triangleArea (my_point,my_point)const;
bool leftTurn (my-point,my_point)cosnt;
bool collinear (my_point,my_point)const;
bool rightTurn (my_point,my_point)const;
private:
int xCoord;
int yCoord;
};
void my_point::moveNE(int n1, int n2)
//
//
}
else{ return false;}
}
bool inThirdQuadrant()
//
//
{
if(xCoord < 0 && yCoord < 0)
{
return true;
}
else{ return false;}
}
bool inFourthQuadrant()
//
//
{
if (xCoord > 0 &&yCoord >0)
{ return true;}
else{ return false;}
}
bool inSameQuadrant (my_point q1)
//
//
{
}
| |