top of page

Polares-Rectangular(Suma ,resta,división,multiplicación y transformación)

#include<iostream>

#include<math.h>

using namespace std;

int main()

{

int xa1,ya1,xb2,yb2,Xa,Ya;

cout<<"Digite el valor de xa1: ";cin>>xa1;cout<<"Digite el valor de ya1: ";cin>>ya1;

cout<<"Digite el valor de xb2: ";cin>>xb2;cout<<"Digite el valor de yb2: ";cin>>yb2;

if(xa1!=2)

{

if(xa1<100)

{

Xa=xa1+xb2;

Ya=ya1+yb2;

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

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

}

else cout<<"Ingrese un valor menor a 100 "<<endl;

}

else cout<<"xa1 tiene que ser diferente a 2 "<<endl;//Fin suma

int Xb,Yb;

if(xa1!=5)

{

if(ya1>450)

{

Xb=xa1-xb2;

Yb=ya1-yb2;

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

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

}

else cout<<"Ingrese un valor mayor a 450"<<endl;

}

else cout<<"xa1 tiene que ser diferente a 5"<<endl;//Fin resta

int ra1,rb2,phi1,phi2,Ra,PHIa;

cout<<"Digite el valor de ra1: ";cin>>ra1;cout<<"Digite el angulo de phi1: ";cin>>phi1;

cout<<"Digite el valor de rb2: ";cin>>rb2;cout<<"Digite el angulo de phi2: ";cin>>phi2;

if(ra1<5)

{

if(rb2>0)

{

Ra=ra1*rb2;

PHIa=phi1+phi2;

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

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

}

else cout<<"Ingre un valor mayor a 0";

}

else cout<<"ra1 tiene que ser menor a 5"<<endl;//fin multiplicacion polar

int Rb,PHIb;

if(ra1!=3)

{

if(rb2>0)

{

Rb=ra1/rb2;

PHIb=phi1-phi2;

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

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

}

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

}

else cout<<"ra1 tiene que ser diferente de 3"<<endl;//fin de division polar

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

if(xa1!=0)

{

if(xb2!=0)

{

RAD1=atan (ya1/xa1);

RAD2=atan (yb2/xb2);

Rr1=sqrt(pow(xa1,2)+pow(ya1,2));

Rr2=sqrt(pow(xb2,2)+pow(yb2,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(rb2<=500)

{

if(phi2<450)

{

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

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

Xp1=ra1*cos (Rad1);

Xp2=rb2*cos (Rad2);

Yp1=ra1*sin (Rad1);

Yp2=rb2*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 450";

}

else cout<<"rb2 debe ser <= 500"<<endl;//fin polar a rectangular

double Rr,PHIr,RADf,Xf,Yf;

if(xb2<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<<"xb2 tiene que ser menor a 500"<<endl;//fin division de rectangulares

double Xp,Yp,Rf,PHIf,RADf2;

if(rb2>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<<"rb2 tiene que ser mayo que 0"<<endl;//fin suma de polares


return 0;

}






19 visualizaciones0 comentarios

Entradas Recientes

Ver todo

(Burbuja, selección, inserción y shell)

#include <iostream> #include <math.h> using namespace std; int BURBUJA(); int SELECCION_SORT(); int INSERCION(); int SHELL(); int QUICK_SORT(); int Aux,i,p,q,r,N,j,A[6],B[6],C[6],D[6],E[6],May[6],Men[

Ejercicio de Matrices

#include<iostream> #include<math.h> using namespace std; float leer(),multiplicar(),Ec_2Grado(),visualizar(),Voltaje(); int opcion,a,b,c,A[100][100],B[100][100],C[100][100],i,j,z,Vo=100,w,t,V[50][30];

bottom of page