#include <iostream>
#include <complex>
using
namespace
std;
typedef
complex<
double
> point;
#define x real()
#define y imag()
#define PI 3.1415926535897932384626
void
displayPoint(point P)
{
cout <<
"("
<< P.x <<
", "
<< P.y <<
")"
<< endl;
}
int
main()
{
point P(4.0, 3.0);
cout <<
"The X-coordinate of point P is: "
<< P.x << endl;
cout <<
"The Y-coordinate of point P is: "
<< P.y << endl;
cout <<
"The distance of point P from origin is: "
<<
abs
(P) <<endl;
cout <<
"The squared distance of point P from origin is: "
<< norm(P) <<endl;
cout <<
"The angle made by OP with the X-Axis is: "
<< arg(P) <<
" radians"
<< endl;
cout <<
"The angle made by OP with the X-Axis is: "
<< arg(P)*(180/PI) <<
" degrees"
<< endl;
point P_rotated = P * polar(1.0, PI/2);
cout<<
"The point P on rotating 90 degrees anti-clockwise becomes: P_rotated"
;
displayPoint(P_rotated);
return
0;
}