You are on page 1of 1

#include<iostream.

h>
#include<math.h>
class point{
float x,y;
public:
point(float=0,float=0);
void displace (float,float);
float get_x(){return (x);}
float get_y(){return(y);}
void homototic(float);
void rotation (float);
float rho();
float theta();
};
point::point(float a,float b){
x=a;
y=b;
}
void point::displace(float a,float b){
x+=a;
y+=b;}
void point::homototic(float rat){
x*=rat;
y*=rat;
}
float point::rho(){
return sqrt(x*x+y*y);
}
float point::theta(){
return atan(y/x);
}
void point::rotation(float angle){
float t;
t=atan(y/x);
t+=angle;
float r=sqrt(x*x+y*y);
x=r*cos(t);
y=y*sin(t);
}
void main(){
point m1(3,5);
cout<<m1.get_x()<<" "<<m1.get_y()<<endl;
m1.displace(0,-1);
cout<<m1.get_x()<<" "<<m1.get_y()<<endl;
cout<<"rho="<<m1.rho()<<endl;
cout<<"theta="<<m1.theta()<<endl;
m1.rotation(45);
cout<<m1.get_x()<<" "<<m1.get_y()<<endl;
}

You might also like