TAREA 02/04/19
#include <iostream>
#include <math.h>
using namespace std;
int main ()
{
cout<<"convertir de R a P\n";
double x1,y1,x2,y2,r;
double phi1,pi=3.1416,r1,r2,RAD1,RAD2;
cout<<"(radio1) "; cin>>r1;
cout<<"(radio2)"; cin>>r2;
cout<<"(PHI1)"; cin>> phi1;
//CONVERTIR
RAD1=(2*pi*phi1)/360;
RAD2=(2*pi*phi1)/360;
x1=r1*cos(RAD1);
y1=r1*sin(RAD1);
x2=r2*cos(RAD2);
y2=r2*sin(RAD2);
//RECTANGULAR
cout<<"z1= "<<(x1+x2)<<"+j "<<(y1+y2)<<endl;
//POLAR
r=sqrt(pow((x1+x2),2)+pow((y1+y2),2));
phi1=atan((y1+y2)/(x1+x2));
cout<<"radio: "<<r<<"angulo:"<<phi1<<endl;
cout<<"convertir de P a R \n";
double x1,y1,x2,y2,r;
double phi,phi1,phi2,pi=3.1416,r1,r2,RAD1,RAD2;
//CONVERTIR
cout<<"(radio1) "; cin>>r1;
cout<<"(radio2)"; cin>>r2;
RAD1=(2*pi*phi1)/360;
RAD2=(2*pi*phi1)/360;
x1=r1*cos(RAD1);
y1=r1*sin(RAD1);
x2=r2*cos(RAD2);
y2=r2*sin(RAD2);
//POLAR
r=sqrt(pow((x1+x2),2)+pow((y1+y2),2));
phi1=atan((y1+y2)/(x1+x2));
cout<<"radio: "<<r<<"angulo: "<<phi<<endl;
//RECTANGULAR
cout<<"z1= "<<(x1+x2)<<"+j "<<(y1+y2)<<endl;
cout<<"suma de R \n";
int r1,r2;
double phi1,pi=3.1416,RAD1,RAD2,x1,x2,y1,y2;
//ASIGNACION
cout<<"(radio1) "; cin>>r1;
cout<<"(radio2)"; cin>>r2;
cout<<"(phi1)"; cin>>phi1;
//CONVERTIR
RAD1=(2*pi*phi1)/360;
RAD2=(2*pi*phi1)/360;
x1=r1*cos(RAD1);
y1=r1*sin(RAD1);
x2=r2*cos(RAD2);
y2=r2*sin(RAD2);
//RECTANGULAR
cout<<"z1= "<<(x1+x2)<<"+j "<<(y1+y2)<<endl;
cout<<"divide P \n";
int x1,y1,x2,y2;
double phi,phi1,phi2,r,r1,r2,x,y;
cout<<"(x1)";cin>>x1;
cout<<"(y1)";cin>>y1;
cout<<"(x2)";cin>>x2;
cout<<"(y2)";cin>>y2;
r1=sqrt(x1*x1*y1*y1);
r2=sqrt(pow(x2,2)+pow(y2,2));
phi1=atan(y1/x1);
phi2=atan(y2/x2);
//MULTIPLICAR
cout<<"radio= "<<(r1*r2)<<" angulo= "<<(phi1-phi2)<<endl;
x=(r1*r2)*cos(phi1-phi2);
y=(r1*r2)*sin(phi1-phi2);
//POLAR
r=sqrt(pow((x1+x2),2)+pow((y1+y2),2));
phi1=atan((y1+y2)/(x1+x2));
cout<<"radio: "<<r<<"angulo: "<<phi<<endl;
cout<<"suma P \n";
int r1,r2;
double x1,x2,y1,y2,phi,phi1,phi2,pi=3.1416,r,RAD1,RAD2;
//ASIGNACION
cout<<"(radio1) "; cin>>r1;
cout<<"(radio2)"; cin>>r2;
cout<<"(phi1)"; cin>>phi1;
//CONVERTIR
RAD1=(2*pi*phi1)/360;
RAD2=(2*pi*phi1)/360;
x1=r1*cos(RAD1);
y1=r1*sin(RAD1);
x2=r2*cos(RAD2);
y2=r2*sin(RAD2);
//POLAR
r=sqrt(pow((x1+x2),2)+pow((y1+y2),2));
phi1=atan((y1+y2)/(x1+x2));
cout<<"radio: "<<r<<"angulo:"<<phi<<endl;
cout<<"multiplica R \n";
int x1,y1,x2,y2;
double phi1,phi2,r1,r2,x,y;
cout<<"(x1)";cin>>x1;
cout<<"(y1)";cin>>y1;
cout<<"(x2)";cin>>x2;
cout<<"(y2)";cin>>y2;
r1=sqrt(x1*x1*y1*y1);
r2=sqrt(pow(x2,2)+pow(y2,2));
phi1=atan(y1/x1);
phi2=atan(y2/x2);
//DIVIDIR
cout<<"radio="<<(r1/r2)<<"angulo="<<(phi1-phi2)<<endl;
x=(r1/r2)*cos(phi1-phi2);
y=(r1/r2)*sin(phi1-phi2);
//RECTANGULAR
cout<<"z1= "<<(x1+x2)<<"+j "<<(y1+y2)<<endl;
//system("pause")
//retun 0;
}//fin del programa