trabajo lp ultimo

14
#include<iostream> #include<math.h> #include <string> using namespace std; // DECLARACION DE VARIABLES PUBLICAS int F,M,V_I,G,T,V,D_H,P_A,P,DEN,VOL,CONS_D,L,MO_Y,S; double PE, A,H, D, P_H, W, DEF, AL; int main() { int opcion; cout << "******** MENU ************** "<<endl; cout << "1) HALLANDO LA ACELERACION"<<endl; cout << "2) HALLANDO LA ALTURA"<<endl; cout << "3) HALLANDO LA DISTANCIA"<<endl; cout << "4) HALLANDO LA PRESION_HIDROSTATICA"<<endl; cout << "5) HALLANDO EL TRABAJO"<<endl; cout << "6) HALLANDO LA ACELERACION"<<endl; cout << "7) HALLANDO LA DISTANCA_HORIZONTAL"<<endl; cout << "8) HALLANDO EL PESO"<<endl; cout << "9) HALLANDO LA DEFORMACION"<<endl; cout << "10) HALLANDO EL ALARGAMIENTO"<<endl; cout << "11) SALIR"<<endl; cin>> opcion; cout<<endl;

Upload: victor-garcia

Post on 26-Jun-2015

382 views

Category:

Education


3 download

DESCRIPTION

TRABAJO DE LENGUAJE DE PROGRAMA

TRANSCRIPT

Page 1: Trabajo lp ultimo

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

using namespace std;// DECLARACION DE VARIABLES PUBLICAS  int F,M,V_I,G,T,V,D_H,P_A,P,DEN,VOL,CONS_D,L,MO_Y,S;  double PE, A,H, D, P_H, W, DEF, AL;

int main(){

  int opcion;

    cout << "******** MENU ************** "<<endl;    cout << "1) HALLANDO LA ACELERACION"<<endl;    cout << "2) HALLANDO LA ALTURA"<<endl;    cout << "3) HALLANDO LA DISTANCIA"<<endl;    cout << "4) HALLANDO LA PRESION_HIDROSTATICA"<<endl;    cout << "5) HALLANDO EL TRABAJO"<<endl;    cout << "6) HALLANDO LA ACELERACION"<<endl;    cout << "7) HALLANDO LA DISTANCA_HORIZONTAL"<<endl;    cout << "8) HALLANDO EL PESO"<<endl;    cout << "9) HALLANDO LA DEFORMACION"<<endl;    cout << "10) HALLANDO EL ALARGAMIENTO"<<endl;    cout << "11) SALIR"<<endl;

    cin>> opcion;    cout<<endl;

Page 2: Trabajo lp ultimo

switch (opcion) {

case 1:    {              string mensaje;                mensaje = " F = FUERZA ";            cout << mensaje << endl;            mensaje = " M = MASA ";            cout << mensaje << endl;            mensaje = " A = ACELERACION ";            cout << mensaje << endl;                         cout << " \n " << endl;            cout << " HALLANDO LA ACELERACION \n\n";            cout<<"INGRESE LA CONSTANTE F= ";cin>> F; cout<<endl;    cout<<"INGRESE LA CONSTANTE M= ";cin>> M; cout<<endl;       if (M!=0)         {                 A = F/M;                                  }              else               cout<<" Solucion determinada "; cout<< endl;                                             cout<<" aceleracion = ";cout<< A; cout<<endl;   

    break;    }

      

Page 3: Trabajo lp ultimo

  case 2:   {            string mensaje;                mensaje = " V_I = VELOCIDAD_INICIAL ";            cout << mensaje << endl;            mensaje = " T = TIEMPO ";            cout << mensaje << endl;            mensaje = " G = GRAVEDAD ";            cout << mensaje << endl;             mensaje = " H = ALTURA ";            cout << mensaje << endl;                      cout << " \n " << endl;        cout << " HALLANDO LA ALTURA \n\n";

    cout<<"INGRESE LA CONSTANTE V_I= ";cin>> V_I; cout<<endl;    cout<<"INGRESE LA CONSTANTE T= ";cin>> T; cout<<endl;    cout<<"INGRESE LA CONSTANTE G= ";cin>> G; cout<<endl;   

             H= V_I*T + G*T*T/2;                                                     

     cout<<" ALTURA = ";cout<< H; cout<<endl;   

    break;    }

     

Page 4: Trabajo lp ultimo

case 3:   {            string mensaje;                mensaje = " V = VELOCIDAD ";            cout << mensaje << endl;            mensaje = " T = TIEMPO ";            cout << mensaje << endl;            mensaje = " D = DISTANCIA ";            cout << mensaje << endl;                       cout << " \n " << endl;                cout << " HALLANDO LA DISTANCIA \n\n";          cout<<"INGRESE LA CONSTANTE V= ";cin>> V; cout<<endl;    cout<<"INGRESE LA CONSTANTE T= ";cin>> T; cout<<endl;                       D = V*T;                                        cout<<" DISTANCIA = ";cout<< D; cout<<endl;   

    break;    }

                 

Page 5: Trabajo lp ultimo

case 4:            {            string mensaje;                mensaje = " P_H = PRESION_HIDROSTATICA ";            cout << mensaje << endl;            mensaje = " P_A = PRESION_ATMOSFERICA ";            cout << mensaje << endl;            mensaje = " P = PROFUNDIDAD ";            cout << mensaje << endl;             mensaje = " DEN = DENSIDAD ";            cout << mensaje << endl;             mensaje = " G = GRAVEDAD ";            cout << mensaje << endl;                                                          cout << " \n " << endl;                cout << " HALLANDO LA PRESION_HIDROSTATICA \n\n";              cout<<"INGRESE LA CONSTANTE P_A= ";cin>> P_A; cout<<endl;    cout<<"INGRESE LA CONSTANTE P= ";cin>> P; cout<<endl;    cout<<"INGRESE LA CONSTANTE DEN= ";cin>> DEN; cout<<endl;    cout<<"INGRESE LA CONSTANTE G= ";cin>> G; cout<<endl;                   P_H = P_A + P*DEN*G;                                           cout<<" PRESION_HIDROSTATICA = ";cout<< P_H; cout<<endl;   

    break;    }        

Page 6: Trabajo lp ultimo

case 5:    {              string mensaje;                mensaje = " W = TRABAJO ";            cout << mensaje << endl;            mensaje = " F = FUERZA ";            cout << mensaje << endl;            mensaje = " D = DISTANCIA ";            cout << mensaje << endl;                         cout << " \n " << endl;            cout << " HALLANDO EL TRABAJO \n\n";          cout<<"INGRESE LA CONSTANTE F= ";cin>> F; cout<<endl;    cout<<"INGRESE LA CONSTANTE D= ";cin>> D; cout<<endl;     

               W = F*D ;                             

     cout<<" TRABAJO = ";cout<< W; cout<<endl;   

    break;    }             

Page 7: Trabajo lp ultimo

case 6:    {              string mensaje;                mensaje = " A = ACELERACION ";            cout << mensaje << endl;            mensaje = " F = FUERZA   ";            cout << mensaje << endl;            mensaje = " M = MASA ";            cout << mensaje << endl;                         cout << " \n " << endl;            cout << " HALLANDO LA ACELERACION \n\n";          cout<<"INGRESE LA CONSTANTE F= ";cin>> F; cout<<endl;    cout<<"INGRESE LA CONSTANTE M= ";cin>> M; cout<<endl;     

                A = F/M;                             

     cout<<" ACELERACION = ";cout<< A; cout<<endl;   

    break;    }

   

Page 8: Trabajo lp ultimo

case 7:    {              string mensaje;                mensaje = " D_H = DISTANCIA_HORIZONTAL ";            cout << mensaje << endl;            mensaje = " V = VELOCIDAD  ";            cout << mensaje << endl;            mensaje = " T = TIEMPO ";            cout << mensaje << endl;                         cout << " \n " << endl;            cout << " HALLANDO LA DISTANCIA_HORIZONTAL \n\n";          cout<<"INGRESE LA CONSTANTE V= ";cin>> V; cout<<endl;    cout<<"INGRESE LA CONSTANTE T= ";cin>> T; cout<<endl;     

                D_H = V*T;                             

     cout<<" DISTANCIA_HORIZONTAL = ";cout<< D_H; cout<<endl;   

    break;    }  

 

Page 9: Trabajo lp ultimo

case 8:            {            string mensaje;                mensaje = " PE = PESO ";            cout << mensaje << endl;            mensaje = " DEN = DENSIDAD ";            cout << mensaje << endl;            mensaje = " G = GRAVEDAD ";            cout << mensaje << endl;             mensaje = " VOL = VOLUMEN ";            cout << mensaje << endl;                                                           cout << " \n " << endl;                cout << " HALLANDO EL PESO \n\n";              cout<<"INGRESE LA CONSTANTE DEN= ";cin>> DEN; cout<<endl;    cout<<"INGRESE LA CONSTANTE G= ";cin>> G; cout<<endl;    cout<<"INGRESE LA CONSTANTE VOL= ";cin>> VOL; cout<<endl;

                                      PE = DEN*G*VOL;                                                     cout<<" PE = ";cout<< PE; cout<<endl;   

    break;    }

 

Page 10: Trabajo lp ultimo

case 9:            {            string mensaje;                mensaje = " F = FUERZA ";            cout << mensaje << endl;            mensaje = " CONS_D = CONSTANTE_DEFORMACION ";            cout << mensaje << endl;            mensaje = " DEF = DEFORMACION ";            cout << mensaje << endl;                                                          cout << " \n " << endl;                cout << " HALLANDO LA DEFORMACION \n\n";              cout<<"INGRESE LA CONSTANTE F= ";cin>> F; cout<<endl;    cout<<"INGRESE LA CONSTANTE CONS_D= ";cin>> CONS_D; cout<<endl;                   DEF = F/CONS_D;                                           cout<<" DEFORMACION = ";cout<< DEF; cout<<endl;   

    break;    }      

   

Page 11: Trabajo lp ultimo

case 10:            {            string mensaje;                mensaje = " F = FUERZA ";            cout << mensaje << endl;            mensaje = " L = LONGITUD ";            cout << mensaje << endl;            mensaje = " S = AREA ";            cout << mensaje << endl;             mensaje = " MO_Y = MODULO_YOUNG ";            cout << mensaje << endl;             mensaje = " AL = ALARGAMIENTO ";            cout << mensaje << endl;                                                          cout << " \n " << endl;                cout << " HALLANDO EL ALARGAMIENTO \n\n";              cout<<"INGRESE LA CONSTANTE F= ";cin>> F; cout<<endl;    cout<<"INGRESE LA CONSTANTE L= ";cin>> L; cout<<endl;    cout<<"INGRESE LA CONSTANTE MO_Y= ";cin>> MO_Y; cout<<endl;    cout<<"INGRESE LA CONSTANTE S= ";cin>> S; cout<<endl;                   AL = F*L / (MO_Y*S);                                           cout<<" ALARGAMIENTO = ";cout<< AL; cout<<endl;   

    break;    }  

default:    cout << "GRACIAS POR SU VISITA\n";  }system("pause");