Version:0.9 StartHTML:0000000105 EndHTML:0000003325 StartFragment:0000000152 EndFragment:0000003291
/******************************************************/
/*************** Isidro Pastor Jorda ******************/
/******************************************************/
/****************** Telematica ************************/
/******************************************************/

#include <iostream.h>
#include <stdlib.h>
#include <math.h>

const float PI = 3.1416;

void Polares (float radio, float alfa, float & x, float & y);

int main()
{
    float x, y, radio, alfa, opcion;
    bool radianes;
    x = 0;
    y = 0;

    cout << " Calculo de las coordenadas rectangulares dadas las coordenadas polares " << endl<< endl;
    cout << " Introduccion de los datos en coordenadas polares " << endl;
    cout << endl << " Radio -> ";
    cin >> radio;
    cout << endl << " Angulo -> ";
    cin >> alfa;

    do
    {
        cout << endl << " Los valores introducidos son grados o radianes (1/2) -> " ;
        cin >> opcion;

        if (opcion == 1)
           radianes = true;
        if (opcion == 2)
           radianes = false;
    }
    while (opcion < 1 || opcion > 2 );


    if (radianes)
       Polares (radio, alfa, x, y);
    else
       Polares (radio, alfa * PI /180 , x, y);


    cout << endl << " Las Coordenadas rectangulares del punto son (" << x << ", "<< y << " )" << endl;

    cout << endl;

    system("PAUSE");
    return 0;
}


void Polares (float radio, float alfa, float & x, float & y)
{

    x = radio * cos(alfa);
    y = radio * sin(alfa);

}