LABORATORIO
MIENTRAS

CODIFICACION DE MIENTRAS

VIDEO DEL TEMA

Todos los videos
M
#Include <iostream>
#include <math.h>
using namespace std;
int main ()
{
int opcion;
cout<<"menu polares";
cout<<"1.-suma \n";
cout<<"2.-resta \n";
cout<<"3.-multiplica \n";
cout<<"4.-dividir \n";
cout<<"ingrese una opcion";
cin>>opcion;
switch ( opcion )
{
case 1:
{
int r1,r2,t1,t2;
double x1,x2,y1,y2,pi=3.14;
double b1,b2;
cout<<"Ingrese R1: "; cin>>r1;
cout<<"Ingrese t1: ";cin>>t1;
cout<<"Ingrese R2: ";cin>>r2;
cout<<"Ingrese t2: ";cin>>t2;
b1=((2*pi*t1)/360);
b2=((2*pi*t2)/360);
x1=r1*cos(b1);
x2=r2*cos(b2);
y2=r1*sin(b1);
y2=r1*sin(b2);
cout<<"z= "<<x1+x2<<"+j"<<y1+y2<<endl;
} break;
case 2:
{
int r1,r2,t1,t2;
double x1,x2,y1,y2,pi=3.14;
double b1,b2;
cout<<"Ingrese R1: ";cin>>r1;
cout<<"Ingrese t1: ";cin>>t1;
cout<<"Ingrese R2: ";cin>>r2;
cout<<"Ingrese t2: ";cin>>t2;
b1=((2*pi*t1)/360);
b2=((2*pi*t2)/360);
x1=r1*cos(b1);
x2=r2*cos(b2);
y2=r1*sin(b1);
y2=r1*sin(b2);
cout<<"z= "<<x1-x2<<"-j"<<y1-y2<<endl;
} break
case 3:
{
int x1,x2,y1,y2;
double r1,r2,t1,t2;
cout<<"Ingrese x1: ";cin>>x1;
cout<<"Ingrese y1: ";cin>>y1;
cout<<"Ingrese x2: ";cin>>x2;
cout<<"Ingrese y2: ";cin>>y2;
r1=sqrt(pow(x1,2)+pow(y1,2));
r2=sqrt(pow(x2,2)+pow(y2,2));
t1=atan(y1/x1);
t2=atan(y2/x2);
x1=r1*cos(t1);
x2=r2*cos(t2);
y2=r1*sin(t1);
y2=r1*sin(t2);
cout<<"radio "<<r1*r2<<"*angulo: j"<<y1+y2<<endl;
} break;
CASE 4
{
int x1,x2,y1,y2;
double r1,r2,t1,t2;
cout<<"Ingrese x1: ";cin>>x1;
cout<<"Ingrese y1: ";cin>>y1;
cout<<"Ingrese x2: ";cin>>x2;
cout<<"Ingrese y2: ";cin>>y2;
r1=sqrt(pow(x1,2)+pow(y1,2));
r2=sqrt(pow(x2,2)+pow(y2,2));
t1=atan(y1/x1);
t2=atan(y2/x2);
x1=r1*cos(t1);
x2=r2*cos(t2);
y2=r1*sin(t1);
y2=r1*sin(t2);
cout<<"radio "<<r1/r2<<"/angulo: "<<y1-y2<<endl;
} break;
case 5:
{
int x1,x2,y1,y2;
double r1,r2,t1,t2,s1,s2,pi=3.14;
double r,s,x,y;
cin>>x1;
cin>>y1;
cin>>x2;
cin>>y2;
r1=sqrt(pow(x1,2)+pow(y1,2));
r2=sqrt(pow(x1,2)+pow(y1,2));
t1=atan(y1/x1);
t2=atan(y2/x2);
s1=(r1*360)/(2*pi);
s2=(r2*360)/(2*pi);
r=r1*r2;
s=s1*s2;
x=r*cos(5);
y=r*sin(5);
cout<<"z= "<<x<<"+j"<<y<<endl;
} break;