#include <iostream>
      int x;
      float a,b,c,d;
float espacio(float,float);
float velocidad(float,float);
float tiempo(float,float);
float fuerza(float,float);
float energia_cinetica(float,float);
float energia_potencial(float,float);
float trabajo(float,float);
float potencia(float,float);
float presion(float,float);
float velocidad_propagacion(float,float);
using namespace std;
int main()
{
    int op;
    float l;
    do
    {
     cout << endl << "MENU DE FORMULAS" << endl << endl;
 cout << "1. ESPACIO" << endl;
 cout << "2. VELOCIDAD" << endl;
 cout << "3. TIEMPO" << endl;
 cout << "4. FUERZA" << endl;
 cout << "5. ENERGIA POTENCIAL" << endl;
 cout << "6. ENERGIA CINETICs" << endl;
 cout << "7. TRABAJO" << endl;
 cout << "8. POTENCIA" << endl;
 cout << "9. PRESION" << endl;
 cout << "10. VELOCIDAD DE PROPAGACION" << endl;
 cout << "0. Finalizar" << endl << endl;
 cout << "Introduzca la opcion elegida: ";
 cin >> op;
 if ( op != 0 )
 {
  do
  {
  } while ( l<0 );
  switch (op)
  {
   case 1:
    {
         cout << "CALCULO DEL ESPACIO \n\n";
         cout << "INGRESE LA VELOCIDAD : "; cin>>a;
         cout << "INGRESE EL TIEMPO : "; cin>>b;
         d = espacio(a,b);
         cout <<"El ESPACIO ES : "<<d<<"\n\n";
      break;
       }
    break;
   case 2:
    {
            cout << "CALCULO DE LA VELOCIDAD \n\n ";
            cout << "INGRESE EL ESPACIO : "; cin>>a;
            cout << "INGRESE EL TIEMPO : "; cin>>b;
            if (b != 0 )
              {
                d= velocidad(a,b);
                cout <<"LA VELOCIDAD ES : "<<d<<"\n\n";
              }
            else
              cout<<"INDETERMINADO";
        break;
         }
   case 3:
    {
            cout << "CALCULO DEL TIEMPO \n\n ";
            cout << "INGRESE EL ESPACIO : "; cin>>a;
            cout << "INGRESE LA VELOCIDAD : "; cin>>b;
            if (b != 0 )
              {
                d= tiempo(a,b);
                cout <<"EL TIEMPO ES : "<<d<<"\n\n";
              }
            else
              cout<<"INDETERMINADO";
        break;
         }
   case 4:
                 {
         cout << "CALCULO DE LA FUERZA \n\n ";
         cout << "INGRESE LA MASA : "; cin>>a;
         cout << "INGRESE LA ACELERACION : "; cin>>b;
         d=fuerza(a,b);
         cout <<"LA FUERZA ES : "<<d<<"\n\n";
      break;
       }
            case 5:
                 {
         cout << "CALCULO DE LA ENERGIA CINETICA \n\n ";
         cout << "INGRESE LA MASA : "; cin>>a;
         cout << "INGRESE LA VELOCIDAD : "; cin>>b;
         d= energia_cinetica(a,b);
         cout <<"LA ENERGIA CINETICA ES : "<<d<<"\n\n";
      break;
       } 
            case 6: 
                 {
         cout << "CALCULO DE ENERGIA POTENCIAL \n\n ";
         cout << "INGRESE LA MASA : "; cin>>a;
         cout << "INGRESE LA ALTURA : "; cin>>b;
         d= energia_potencial(a,b);
         cout <<"LA ENERGIA POTENCIAL ES : "<<d<<"\n\n";
      break;
       }
             case 7:
                  {
         cout << "CALCULO DEL TRABAJO\n\n ";
         cout << "INGRESE LA FUERZA : "; cin>>a;
         cout << "INGRESE LA DISTANCIA : "; cin>>b;
         d= trabajo(a,b);
         cout <<"EL TRABAJO ES : "<<d<<"\n\n";
      break;
       }
             case 8:
                   {
         cout << "CALCULO DE LA POTENCIA\n\n ";
         cout << "INGRESE EL TRABAJO : "; cin>>a;
         cout << "INGRESE EL TIEMPO : "; cin>>b;
         d= potencia(a,b);
         cout <<"LA POTENCIA ES : "<<d<<"\n\n";
      break;
       }
             case 9:
                    {
         cout << "CALCULO DE LA PRESION\n\n ";
         cout << "INGRESE LA FUERZA : "; cin>>a;
         cout << "INGRESE EL AREA : "; cin>>b;
         d= presion(a,b);
         cout <<"LA PRESION ES : "<<d<<"\n\n";
      break;
       }
             case 10:
                  {
         cout << "CALCULO VELOCIDAD DE PROPAGACION\n\n ";
         cout << "INGRESE LA FRECUENCIAR : "; cin>>a;
         cout << "INGRESE LA LONGITUD : "; cin>>b;
          d=velocidad_propagacion(a,b);
          cout <<"LA VELOCIDAD DE PROPAGACION = "<<d<<"\n\n";
      break;
       }     
   defaul:
    cout << endl << "Opcion no valida" << endl;
    break;
  }
 }
    // FIN DEL PRIMER BUCLE
    } while ( op != 0 );
    cout << endl << "Gracias por utilizar el programa" << endl;
    return 0;
}
float espacio(float a,float b)
{
 return a*b;
}
float velocidad(float a,float b)
{
 return a/b;
}
float tiempo(float a,float b)
{
 return a/b;
}
float fuerza(float a,float b)
{
 return a*b;
}
float energia_cinetica(float a,float b)
{
 return (a*(b*b))/2;;
}
float energia_potencial(float a,float b)
{
 return (a*b)*9.8;
}
float trabajo(float a,float b)
{
 return a*b;
}
float potencia(float a,float b)
{
 return a/b;
}
float presion(float a,float b)
{
 return a/b;
}
float velocidad_propagacion(float a,float b)
{
 return a*b;
}
 
No hay comentarios:
Publicar un comentario