top of page

POLARES

  • Foto del escritor: Erick Bryan Geldres Asto
    Erick Bryan Geldres Asto
  • 8 abr 2019
  • 2 Min. de lectura

#include<iostream>

#include<math.h>

using namespace std;

int main()

{

int x1,y1,x2,y2,Xa,Ya;

cout<<"Ingrese el valor de x1: ";cin>>x1;cout<<"Ingrese el valor de y1: ";cin>>y1;

cout<<"Ingrese el valor de x2: ";cin>>x2;cout<<"Ingrese el valor de y2: ";cin>>y2;

if(x1!=0)

{

if(x1>-50)

{

Xa=x1+x2;

Ya=y1+y2;

cout<<"La suma es:"<<endl;

cout<<"Za= "<<Xa<<" +j"<<Ya<<endl;

}

else cout<<"Ingrese un valor mayor a -50 "<<endl;

}

else cout<<"x1 tiene que ser diferente a 0 "<<endl;//Fin suma

//////////////////////////////////////

int Xb,Yb;

if(x1!=0)

{

if(y1<1000)

{

Xb=x1-x2;

Yb=y1-y2;

cout<<"la resta es:"<<endl;

cout<<"Zb= "<<Xb<<" +j"<<Yb<<endl;

}

else cout<<"y1 tiene que ser menor a 1000"<<endl;

}

else cout<<"x1 tiene que ser diferente a 0"<<endl;//Fin resta

/////////////////////////////////////////////

int r1,r2,phi1,phi2,Ra,PHIa;

cout<<"ingres el valor del r1: ";cin>>r1;cout<<"ingrese el angulo phi1: ";cin>>phi1;

cout<<"ingres el valor del r2: ";cin>>r2;cout<<"ingrese el angulo phi2: ";cin>>phi2;

if(r1>0)

{

if(r2>0)

{

Ra=r1*r2;

PHIa=phi1+phi2;

cout<<"la multiplicacion del polar es:"<<endl;

cout<<"Z1= "<<Ra<<"*<"<<PHIa<<endl;

}

else cout<<"r2 tiene que ser mayor a 0";

}

else cout<<"r1 tiene que ser mayor a 0"<<endl;//fin multiplicacion polar

/////////////////////////////////////////////

int Rb,PHIb;

if(r1>0)

{

if(r2>0)

{

Rb=r1/r2;

PHIb=phi1-phi2;

cout<<"la division del polar es: "<<endl;

cout<<"Z2= "<<Rb<<"*<"<<PHIb<<endl;

}

else cout<<"r2 tiene que ser mayor a 0";

}

else cout<<"r1 tiene que ser mayor a 0"<<endl;//fin de division polar

//////////////////////////////////////////////

double Rr1,Rr2,PHIr1,PHIr2,PI=3.141592,RAD1,RAD2;

if(x1!=0)

{

if(x2!=0)

{

RAD1=atan (y1/x1);

RAD2=atan (y2/x2);

Rr1=sqrt(pow(x1,2)+pow(y1,2));

Rr2=sqrt(pow(x2,2)+pow(y2,2));

PHIr1=(RAD1*360)/(2*PI);

PHIr2=(RAD2*360)/(2*PI);

cout<<"el numero complejo en Polar es:"<<endl;

cout<<"Zr1= "<<Rr1<<"*<"<<PHIr1<<endl;

cout<<"Zr2= "<<Rr2<<"*<"<<PHIr2<<endl;

}

else cout<<"ingrese un valor diferente de 0";

}

else cout<<"ingrese un valor diferente de 0"<<endl;//fin rectangular a polar

/////////////////////////////////////////

double Xp1,Xp2,Yp1,Yp2,Rad1,Rad2;

if(r2<1000)

{

if(phi2<3600)

{

Rad1=(2*PI*phi1)/360;

Rad2=(2*PI*phi2)/360;

Xp1=r1*cos (Rad1);

Xp2=r2*cos (Rad2);

Yp1=r1*sin (Rad1);

Yp2=r2*sin (Rad2);

cout<<"el numero complejo en Rectangular es:"<<endl;

cout<<"Zp1= "<<Xp1<<" +j"<<Yp1<<endl;

cout<<"Zp2= "<<Xp2<<" +j"<<Yp2<<endl;

}

else cout<<"Ingrese un angulo menor a 3600";

}

else cout<<"r2 < 2000"<<endl;//fin polar a rectangular

/////////////////////////////////////////

double Rr,PHIr,RADf,Xf,Yf;

if(x2<500)

{

Rr=Rr1/Rr2;

PHIr=PHIr1-PHIr2;

RADf=(2*PI*PHIr)/360;

Xf=Rr*cos (RADf);

Yf=Rr*sin (RADf);

cout<<"la division del rectangular es: "<<endl;

cout<<"Dr= "<<Xf<<"+j"<<Yf<<endl;

}

else cout<<"x2 tiene que ser menor a 500"<<endl;//fin division de rectangulares

////////////////////////////////////////////////

double Xp,Yp,Rf,PHIf,RADf2;

if(r2!=0)

{

Xp=Xp1+Xp2;

Yp=Yp1+Yp2;

Rf=sqrt(pow(Xp,2)+pow(Yp,2));

RADf2=atan (Yp/Xp);

PHIf=(RADf2*360)/(2*PI);

cout<<"la suma del polar es: "<<endl;

cout<<"Sp= "<<Rf<<" *<"<<PHIf<<endl;

}

else cout<<"r2 tiene que ser diferente a 0"<<endl;//fin suma de polares


return 0;

}



 
 
 

Comments


© 2023 para  Le Cõuleur. Creado con Wix.com

bottom of page