CSE1002 Sort a Given Set of Points
Design a OOP model to represent a point in a two dimensional space and overload the operators >>,<<, > and ==. Given 'n' points, design an algorithm and write a C++ code to sort them in desceding order. While sorting a point is said to be greater than the other based on their x-coordinate value. If value of x-coordinate is same for both the points then make a decision based on their value of y-coordinate.
==============================================================
UML:

CODE:
istream& operator>>(istream& in,point &p)
{
in>>p.x>>p.y;
return in;
}
ostream& operator<<(ostream& out,point& p)
{
out<<p.x<<endl<<p.y<<endl;
return out;
}
bool point::operator==(point& p)
{
return p.x==x&&p.y==y;
}
bool point::operator>(point& p)
{
if(p.x==x)
return y>p.y;
return x>p.x;
}
void sort_Points(point *p,int s)
{
point temp;
for(int i=0;i<s;i++)
for(int j=i+1;j<s;j++)
if(*(p+j)>*(p+i))
{temp=*(p+i);
*(p+i)=*(p+j);
*(p+j)=temp;}
}

