top of page

#include <iostream>
#include <math.h>
using namespace std;
int main()
{    int menu;
    cout<<"Menu";
    cout<<endl;
    cout<<"****************************************** \n";
    cout<<"1. Suma y Resta (Rectangulares)";
    cout<<endl;
    
    cout<<"2. Multiplicacion y Division (Polares)";
    cout<<endl;
    
    cout<<"3. Conversion de Rectangulares a Polares";
    cout<<endl;
    
    cout<<"4. Conversion de Polares a Rectangulares";
    cout<<endl;
    
    cout<<"Elegir Opcion: "; cin>>menu;
    
    switch(menu)
    {
        case 1:
        cout<<endl;
        cout<<"Calculo de la Suma y Resta (Rectangulares)";
        cout<<endl;
        

        int R1, R2, PHI1, PHI2;
        double RAD1, RAD2, PI, X1, X2, Y1, Y2;

        //DATOS POLARES
        
        cout<<"Ingrese el Valor de R1: "; cin>>R1;
        cout<<endl;
        cout<<"Ingrese el Valor de R2: "; cin>>R2;
        cout<<endl;
        cout<<"Ingrese el Valor de Phi1: "; cin>>PHI1;
        cout<<endl;
        cout<<"Ingrese el Valor de Phi2: "; cin>>PHI2;
        cout<<endl;
        
        PI = 3.141592;
        
        if (R1 > 13)
        {    if (PHI1 > 30)
            {
                //CONVERTIR
        
                RAD1 = (2 * PI * PHI1) / 360;
                cout<<"El Valor de RAD1 es: "<< RAD1<<endl;
                cout<<endl;
                RAD2 = (2 * PI * PHI2) / 360;
                cout<<"El Valor de RAD2 es: "<< RAD2<<endl;
                cout<<endl;
        
                //CONVERSION DE POLARES A RECTANGULARES
                
                cout<<"Resultados Rectangulares: ";
                cout<<endl;
    
                    
                X1 = R1 * cos(RAD1);
                cout<<" Valor de X1 : "<< X1<<endl;
                cout<<endl;
                Y1 = R1 * sin(RAD1);
                cout<<" Valor de Y1 : "<< Y1<<endl;
                cout<<endl;
                X2 = R2 * cos(RAD2);
                cout<<" Valor de X2 : "<< X2<<endl;
                cout<<endl;
                Y2 = R2 * sin(RAD2);
                cout<<"Valor de Y2 : "<< Y2<<endl;
                cout<<endl;
        
                //SUMA
        
                cout<<"Suma: ";
                    cout<<endl;
                cout<<"Z = "<<(X1 + X2)<<" + j "<<(Y1 + Y2)<<endl;
                cout<<endl;
        
                //RESTA
        
                cout<<"Resta: ";
                cout<<endl;
                cout<<"Z = "<<(X1 - X2)<<" + j "<<(Y1 - Y2)<<endl;
                cout<<endl;
              
            }
                
           else
            {
                cout<<"Fuera de Rango";
                cout<<endl;
                
            }
            
        }
        
        else
        {
            cout<<"Fuera de Rango";
            cout<<endl;
        
        }
        
        
        
        case 2:
        cout<<endl;
        cout<<"Calculo de la Multiplicacion - Division (Polares)";
        cout<<endl;
        
        
        int x1, y1, x2, y2;
        double r1, r2, phi1, phi2;
        
        //DATOS RECTANGULARES
        
        cout<<"Ingresar el Valor de X1: "; cin>>x1;
        cout<<endl;
        cout<<"Ingresar el Valor de X2: "; cin>>x2;
        cout<<endl;
        cout<<"Ingresar el Valor de Y1: "; cin>>y1;
        cout<<endl;
        cout<<"Ingresar el Valor de Y2: "; cin>>y2;
        cout<<endl;
        
        if (x1 < 20)
        {    if (y1 > 40)
            {
                //CONVERSION DE RECTANGULARES A POLARES
                
                cout<<"Resultados Polares: ";
                cout<<endl;
                cout<<endl;
                
                r1 = sqrt(pow ((x1), 2) + pow ((y1), 2));
                cout<<" Valor de R1 : "<< r1<<endl;
                cout<<endl;
                r2 = sqrt(pow ((x2), 2) + pow ((y2), 2));
                cout<<" Valor de R2 : "<< r2<<endl;
                cout<<endl;
                phi1 = atan(y1 / x1);
                cout<<"Valor de PHI1 : "<< phi1<<endl;
                cout<<endl;
                phi2 = atan(y2 / x2);
                cout<<" Valor de PHI2: "<< phi2<<endl;
                cout<<endl;
        
                //MULTIPLICACION
        
                cout<<"Multiplicacion: ";
                cout<<endl;
                cout<<"Radio = "<<(r1 * r2)<<" Angulo = "<<(phi1 + phi2)<<endl;
                cout<<endl;
        
                //DIVISION
        
                cout<<"Division: ";
                cout<<endl;
                cout<<"Radio = "<<(r1 / r2)<<" Angulo = "<<(phi1 - phi2)<<endl;
                cout<<endl;
               
            }
            
            else
            {
                cout<<"Fuera de Rango";
                cout<<endl;
              
            }
        }
        
        else
        {
            cout<<"Fuera de Rango";
            cout<<endl;
           
        }
    
        break;
        
        case 3:
        cout<<endl;
        cout<<"Conversion de Rectangular a Polar";
        cout<<endl;
        
        int X, Y;
        double R, PHI;
        
        //DATOS RECTANGULARES
        
        cout<<"Ingresar el Valor de X: "; cin>>X;
        cout<<endl;
        cout<<"Ingresar el Valor de Y: "; cin>>Y;
        cout<<endl;
        
        if (X > 33)
        {    if (Y < 50)
            {
                //CONVERSION DE RECTANGULARES A POLARES
                cout<<"Resultados Polares: ";
                cout<<endl;
                
                R = sqrt(pow((X), 2) + pow((Y), 2));
                cout<<"Valor de R: "<< R<<endl;
                cout<<endl;
                PHI = atan(Y / X);
                cout<<" Valor de PHI: "<< PHI<<endl;
                cout<<endl;
                //POLAR
                cout<<"Radio = "<<(R)<<" Angulo = "<<(PHI)<<endl;
                cout<<endl;
              
            }
            else
            {
                cout<<"Fuera de Rango";
                cout<<endl;
             
            }
        }
        else
        {
            cout<<"Fuera de Rango";
            cout<<endl;
           
        }
    
        break;
        
        case 4:
        cout<<endl;
        cout<<"Conversion de Polares a Rectangulares";
        cout<<endl;

        int r, phi;
        double x, y, rad, pi;
        
        //DATOS POLARES
        
        cout<<"Ingresar el Valor de R: "; cin>>r;
        cout<<endl;
        cout<<"Ingresar el Valor de PHI: "; cin>>phi;
        cout<<endl;
        pi = 3.141592;
        
        if(r > 30)
        {    if (phi < 20)
            {
                //CONVERTIR
        
                rad = (2 * pi * phi) / 360;
                cout<<" Valor de Rad : "<< rad<<endl;
                cout<<endl;
        
                //CONVERSION DE POLARES A RECTANGULARES
                cout<<"Resultados Rectangulares: ";
                cout<<endl;
                
                x = r * cos(rad);
                cout<<" Valor de X : "<< x<<endl;
                cout<<endl;
                y = r * sin(rad);
                cout<<"Valor de Y : "<< y<<endl;
                cout<<endl;
        
                //RECTANGULAR
            
                cout<<"Z = "<<(x)<<" + j "<<(y)<<endl;
                cout<<endl;
             
            }
            
            else
            {
                cout<<"Fuera de Rango";
                cout<<endl;
               
            }
        }
        
        else
        {
            cout<<"Fuera de Rango";
            cout<<endl;
            
        }
        
        break;
        
        default:
        cout<<endl;
        cout<<"no valido";
        cout<<endl;
       
    }
    
    return 0;
}    //FIN 

POLARES Y RECTANGULARES

© 2023 para Skyline

Creado conWix.com

bottom of page