# include <iostream>
#include <stdlib.h>
# include<math.h>
using namespace std;
int main()
{
cout<<"(01): CONVERTIR POLARES A RECTANGULARES\n";
cout<<" ***************************************\n";
double x,y,r,ar,ag;
cout<<"Introduce el valor del radio: ";cin>>r;
cout<<"Introduce el valor del angulo(en grados): ";cin>>ag;
ar=ag*3.1416/180;
x=r*cos(ar);
y=r*sin(ar);
cout<<"x= "<<x<<"y= "<<y<<endl;
cout<<"(02): CONVERTIR RECTANGULARES A POLARES\n";
cout<<" *******************************************\n";
double ang;
cout<<"Introduce el valor del x: ";cin>>x;
cout<<"Introduce el valor del y: ";cin>>y;
r=sqrt(pow(x,2))+pow(y,2);
ang=atan(x/y);
cout<<"EL RADIO = "<< r <<" y el ANGULO: " <<ang<< endl;
cout<<"(03): SUMAR RECTANGULARES\n";
cout<<" *******************************************\n";
double f1,f2,g1,g2;
cout<<"Ingrese el x1 ", cin>>f1;
cout<<"Ingrese el x2: ", cin>>f2;
cout<<"Ingrese el y1 ", cin>>g1;
cout<<"Ingrese el y2: ", cin>>g2;
cout<<" Z= "<<g1+g2<<" +J "<<g1+g2<<endl;
cout<<"********************************\n";
cout<<"(04): MULTIPLICAR POLARES\n";
cout<<" *******************************************\n";
int R;
double a,b,x1,y1,ang1,ang2,RAD,PI=3.141592;
cout<<"Ingrese el x1 : ";cin>>x1;
cout<<"Ingrese el ANGULO1: ";cin>>ang1;
cout<<"Ingrese el y1 : ";cin>>y1;
cout<<"Ingrese el ANGULO2: ";cin>>ang2;
a=x1*y1;
b=ang1+ang2;
cout<<"x * y = "<< a <<" " <<b<<"°\n";
cout<<"(05): SUMAR POLARES\n";
cout<<" *******************************************\n";
double xi,xii,yi,yii,ri,rii,ang1,ang2,rraadd1,rraadd2;
cout<<"Ingrese el angulo 1: ", cin>>ang1;
cout<<"Ingrese el angulo 2: ", cin>>ang2;
cout<<"Ingrese el radio 1: ", cin>>ri;
cout<<"Ingrese el radio 2: ", cin>>rii;
rraadd1=(2*PI*ang1)/360;
rraadd2=(2*PI*ang2)/360;
xi=ri*cos(rraadd1);
xii=rii*cos(rraadd2);
yi=ri*sin(rraadd1);
yii=rii*sin(rraadd2);
cout<<" Z= "<< xi+xii<<" + J "<<yi+yii<<endl;
cout<<"********************************\n";
cout<<"(06): MULTIPLICAR RECTANGULARES\n";
cout<<" *******************************************\n";
int X1,Y1,X2,Y2;
double PHI1,PHI2,PHI3,RAD1,RAD2,R1,R2,R3;
cout<<"Ingrese el X1: ";cin>>X1;
cout<<"Ingrese el Y1: ";cin>>Y1;
cout<<"Ingrese el X2: ";cin>>X2;
cout<<"Ingrese el Y2: ";cin>>Y2;
R1=sqrt(pow(X1,2))+pow(Y1,2);
PHI1=atan(X1/Y1);
R2=sqrt(pow(X2,2))+pow(Y1,2);
PHI2=atan(X2/Y2);
R3=(R1/R2);
PHI3=PHI1-PHI2;
cout<<"EL RADIO = "<< R3 <<" y el ANGULO: " <<PHI3<< endl;
cout<<" *************************************************** \n";
}