CODIGO.
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
cout<<"MENU"<<endl;
cout<<"**********";
cout<<endl;
double x1, x2, y1, y2, r1, r2, x, y, R, ang, rad, rad1, rad2, R1, R2, ang1, ang2, ang3, R3, ang4, R4, x3, x4, y3, y4;
int pi=3.14;
cout<<endl;
cout<<endl;
cout<<"CONVIRTIENDO RECTANGULARES A POLARES"<<endl;
cout<<"Ingresar X: ";cin>>x;
cout<<"Ingresar Y: ";cin>>y;
R=sqrt(pow(x,2)+pow(y,2));
ang=atan(y/x);
cout<<"Polar es:"<<endl;
cout<<"Radio: "<<R<<endl;
cout<<"Angulo: "<<ang<<endl;
cout<<endl;
cout<<endl;
cout<<"CONVIRTIENDO POLARES A RECTANGULARES"<<endl;
cout<<"Ingresar R: ";cin>>R;
cout<<"Ingresar Angulo: ";cin>>ang;
rad=(2*pi*ang)/360;
x=R*cos(rad);
y=R*sin(rad);
cout<<"Rectangular es:"<<endl;
cout<<"X : "<<x<<endl;
cout<<"Y : "<<y<<endl;
cout<<endl;
cout<<endl;
cout<<"SUMAR Y RESTAR RECTANGULARES"<<endl;
cout<<"Ingresar X1: ";cin>>x1;
cout<<"Ingresar Y1: ";cin>>y1;
cout<<"Ingresar X2: ";cin>>x2;
cout<<"Ingresar Y2: ";cin>>y2;
cout<<"Z1="<<x1<<"+j"<<y1<<endl;
cout<<"Z2="<<x2<<"+j"<<y2<<endl;
cout<<"La suma de los fasores es: "<< endl;
cout<<"Z="<<(x1 + x2)<<"+j"<<(y1 + y2)<<endl;
cout<<"La resta de los fasores es: "<< endl;
cout<<"Z="<<(x1-x2)<<"+j"<<(y1-y2)<<endl;
cout<<endl;
cout<<endl;
cout<<"MULTIPLICAR Y DIVIDIR POLARES"<<endl;
cout<<"Ingresar R1: ";cin>>r1;
cout<<"Ingresar Angulo1: ";cin>>ang1;
cout<<"Ingresar R2: ";cin>>r2;
cout<<"Ingresar Angulo2: ";cin>>ang2;
cout<<"polar1: radio= "<<r1<<", angulo="<<ang1<<endl;
cout<<"polar2: radio= "<<r2<<", angulo="<<ang2<<endl;
cout<<"Multiplicacion Polar es:"<<endl;
cout<<"Radio= "<<(r1*r2)<<", Angulo= "<<(ang1+ang2)<<endl;
cout<<"Division Polar es: "<<endl;
cout<<"Radio= "<<(r1/r2)<<", Angulo = "<<(ang1-ang2)<<endl;
cout<<endl;
cout<<endl;
cout<<"SUMAR Y RESTAR POLARES"<<endl;
cout<<"Ingresar R1: ";cin>>r1;
cout<<"Ingresar Angulo1: ";cin>>ang1;
cout<<"Ingresar R2: ";cin>>r2;
cout<<"Ingresar Angulo2: ";cin>>ang2;
cout<<"polar1: radio= "<<r1<<" ,angulo="<<ang1<<endl;
cout<<"polar2: radio= "<<r2<<" ,angulo="<<ang2<<endl;
cout<<"Convirtiendo a rectangulares"<<endl;
rad1=(2*pi*ang1)/360;
rad2=(2*pi*ang2)/360;
x1=r1*cos(rad1);
y1=r1*sin(rad1);
x2=r2*cos(rad2);
y2=r2*sin(rad2);
cout<<"Z1="<<x1<<"+j"<<y1<<endl;
cout<<"Z2="<<x2<<"+j"<<y2<<endl;
cout<<"A) Suma rectangular"<<endl;
cout<<"Z="<<(x1 + x2)<<"+j"<<(y1 + y2)<<endl;
x3=x1+x2;
y3=y1+y2;
R1=sqrt(pow(x3,2)+pow(y3,2));
ang3=atan(y3/x3);
cout<<"Convirtiendo a polar - Suma polar es : "<<endl;
cout<<"Radio= "<<R1<<", Angulo= "<<ang3<<endl;
cout<<"B) Resta rectangular es: "<<endl;
cout<<"Z="<<(x1-x2)<<"+j"<<(y1-y2)<<endl;
x4=x1-x2;
y4=y1-y2;
R2=sqrt(pow(x4,2)+pow(y4,2));
ang4=atan(y4/x4);
cout<<"Convirtiendo a polar - Resta polar es: "<<endl;
cout<<"Radio= "<<R2<<", Angulo= "<<ang4<<endl;
cout<<endl;
cout<<endl;
cout<<"MULTIPLICAR Y DIVIDIR RECTANGULARES"<<endl;
cout<<"Ingresar X1: ";cin>>x1;
cout<<"Ingresar Y1: ";cin>>y1;
cout<<"Ingresar X2: ";cin>>x2;
cout<<"Ingresar Y2: ";cin>>y2;
cout<<"Z1="<<x1<<"+j"<<y1<<endl;
cout<<"Z2="<<x2<<"+j"<<y2<<endl;
cout<<"Convirtiendo rectangulares a polares"<<endl;
R1=sqrt(pow(x1,2)+pow(y1,2));
ang1=atan(y1/x1);
cout<<"Polar1 : Radio= "<<R1<<", Angulo= "<<ang1<<endl;
R2=sqrt(pow(x2,2)+pow(y2,2));
ang2=atan(y2/x2);
cout<<"Polar2 : Radio= "<<R2<<", Angulo= "<<ang2<<endl;
cout<<"A) Multiplicacion Polar es:"<<endl;
cout<<"Radio= "<<(R1*R2)<<", Angulo= "<<(ang1+ang2)<<endl;
R3=R1*R2;
ang3=ang1+ang2;
rad=(2*pi*ang3)/360;
x3=R3*cos(rad);
y3=R3*sin(rad);
cout<<"Convirtiendo a Rectangular - Multiplicacion rectangular es:"<<endl;
cout<<"Z1="<<x3<<"+j"<<y3<<endl;
cout<<"B) Division Polar es: "<<endl;
cout<<"Radio= "<<(r1/r2)<<", Angulo = "<<(ang1-ang2)<<endl;
R4=R1/R2;
ang4=ang1-ang2;
rad1=(2*pi*ang4)/360;
x4=R4*cos(rad1);
y4=R4*sin(rad1);
cout<<"Convirtiendo a Rectangular - Multiplicacion rectangular es:"<<endl;
cout<<"Z1="<<x4<<"+j"<<y4<<endl;
return 0;
}
EJECUCION
Comments