EVAP 5

                                                       TEMA: MECÁNICA 
                   CAPÍTULO: CÁLCULO DE VIGAS EMPOTRADAS






#include <iostream>
using namespace std;

void multiplicar(int a[], int b[],int F[],int M[],,int dim) {
    for (int i = 0; i < dim; i++) {
        M[i] = (F[i]*(a[i]*b[i]))/(2 * pow(L,2));
    }
}

void imprimir(int v[], int dim)
{
   for(int i = 0; i < dim; i++) {
        cout << v[i] << endl;
   }
   cout << endl << endl;
}

int main()
{
    int dim;
    cout << "Ingresa la dimensión" << endl;
    cin >> dim;

    int a[dim];
    int b[dim];
    int L[dim];
    
    L[dim]= a[dim]+  b[dim] ;
    for(int i = 0; i < dim; i++) {
        a[i] = i * 10;
        b[i] = i * 5;
    }

    cout << "Vector a " << endl;
    imprimir(a, dim);

    cout << "Vector b " << endl;
    imprimir(b, dim);
   
    cout << "Vector F " << endl;
    imprimir(F, dim);
    

    return 0;

CODIFICACIÓN :

// CALCULO DE VIGA EMPOTRADA POR VECTORES
#include<iostream>
#include<conio.h>
#include<math.h>
using namespace std;

int F , a , b , L ;
float M ,RA ,RB ;

int main ()
 {
    //1)DECLARACION
  int opcion;
  do
  { // INICIO DEL DO - WHILE
  cout<<"*********MENU DE FUNCIONES *************************\n\n"; 
  cout<<" 1) CALCULO DEL MOMENTO EMPOTRAMIENTO PERFECTO \n";
  cout<<" 2) CALCULO DE LA REACCION A \n";
  cout<<" 3) CALCULO DE LA REACCION B \n";
  cout<<"          DIGITE <0> PARA SALIR \n\n";
  cout<<"*************************************************\n\n";
  cout<<"   ELIJA UNA OPCION : "; cin>>opcion;
  
  switch (opcion)
    {
    case 1: 
      {
       cout<<"******* CALCULO DEL MOMENTO EMPOTRAMIENTO PERFECTO  *********************\n\n";

       for (i=1; i<=10; i++)
       {
       cout<<"INGRESE EL ELEMENTO F[ "<<i<<" ] = "; cin>>Vector[i]; 
  L= a + b ;
  M[i]=(F[i]*a*b(L+b))/(2*pow(L,2);
      cout<<"EL VALOR ES "<< M[i] <<" = "<< endl;        
       }
       cout<<endl;
       cout<<"**********************************************\n\n";
     } //FIN DEL CASO 1
     break;      

    case 2: 
      {
       cout<<"*******  2) CALCULO DE LA REACCION A *********************\n\n";

       for (i=1; i<=10; i++)
       {
       cout<<" EL ELEMENTO F[ "<<i<<" ] = "<< F[i]<<endl;
  RA[i]=(F*b*(3- pow(b/l,2)))/2L         
       }
       cout<<endl;
       cout<<"**********************************************\n\n";
     } //FIN DEL CASO 2
     break;      
     
  case 3: 
    {   
     cout<<"******* PROCESAR EL MAXIMO *********************\n\n";
     int max=0;
     for (i=1; i<=10; i++)  case 2: 
      {
       cout<<"*******  2) CALCULO DE LA REACCION A *********************\n\n";

       cout<<" EL ELEMENTO F[ "<<i<<" ] = "<< F[i]<<endl;
  RB[i]=(F* pow(a/b,2))*(3- a/L)/2
      }
    
     cout<<endl;  
     cout<<"**********************************************\n\n";
    } //FIN DEL CASO 3
    break;
 
}// FIN DE SWITCH
    
} // FIN DEL DO - WHILE
while (opcion !=0);

    cout<<endl;cout<<"\n";
    system("pause");
    return 0;
}//FIN DEL PROGRAMA


No hay comentarios:

Publicar un comentario