I dont now how to add in the followingCode:#include <iostream>
#include <cmath>
using namespace std;
class point{
private:
double x;
double y;
public:
// constructors
point(){
x=0;
y=0;
return;
}
point( double v){
x=v;
y=v;
return;
}
point( double xv, double yv){
x=xv;
y=yv;
}
// accessors
double getx(){
return x;
}
double gety(){
return y;
}
// modifiers
double setx( double v ){
x =v;
return v;
}
double sety( double v){
y = v;
return v;
}
// operations
double fromorigin(){
return sqrt(x*x + y*y);
}
double distance( point p){
return sqrt( (p.getx() - x) * (p.getx() -x)
+(p.gety() - y) * (p.gety() -y) );
}
};
int main(){
point p1(5), p2(3,4);
cout << p1.getx() << p1.gety()<< endl;
p1.setx(2);
p1.sety(4);
cout << p1.getx() << p1.gety()<<endl;
cout << p2.fromorigin() << endl;
cout << p1.distance(p2) << endl;
}
1)Operators < and > to relate points to their distance from (0,0).
2)Operators == and != to compare points
3)Operators + and - to modify points ( x = x1 +x2, y=y1+y2)
4)Another variable like angle mode that will cause the point to print in rectangular( x,y) or polar (r<theta) with its accessor and modifier.
5)Modification to the ostream to allow the point to print in polar form.
6)Modification to istream to allow a point to be input in polar form.
I would love to have someone help me and I thank everyone in advance for their help