lavoratorio 4

#include<iostream>
#include<math.h>
# include <stdio.h>
using namespace std;

double Promedio_de_la_Suma() , Multiplicacion_de_Matrices() , Determinante_de_Matriz() , Menores_Complementarios() ;
double M [5] [5] ;
double Leer_Matriz() , Ver_Matriz() , Leer_2_Matrices() , Sumar_2_Matrices() , Restar_2_Matrices() ;
double Inversa() , Menor_Indice() , Mayor_Indice() , Matriz_Identidad() , Tanspuesta() ;
int i , j , MIN ,MAX , IND , ij  , Prom , Suma , det , k , l ;
double A [5][5],B [5][5] ,C [5][5],I [5][5],De [5][5],N [5][5],Mu [5][5];

int main()
{
int opcion;
do
{
cout<< "  Menu Opciones : \n " ;
cout<< "   1.- Leer Matriz : \n " ;
cout<< "   2.- Mirar Matriz : \n  " ;
cout<< "  3.- Leer 2 Matrices : \n " ;
cout<< "   4.- Sumar 2 Matrices : \n  " ;
cout<< "  5.- Restar 2 Matrices : \n " ;
cout<< "   6.- Transpuesta : \n " ;
cout<< "   7.- Mayor Indice de la Matriz : \n " ;
cout<< "   8.- Menor Indice de la Matriz : \n " ;
cout<< "   9.- Matriz Identidad : \n " ;
cout<< "   10.- Promedio de la Suma de dos Matrices : \n " ;
cout<< "   11.- Multiplicacion de dos Matrices : \n " ;
cout<<"  ingrese opcion : " ; cin >> opcion;
switch (opcion)
{
case 1:
{
Leer_Matriz();
};break ;

case 2:
{
Ver_Matriz();
};break;
case 3:
{
Leer_2_Matrices();
};break;

case 4:
{
Sumar_2_Matrices();
};break;

case 5:
{
Restar_2_Matrices();
};break;

case 6:
{
Tanspuesta();
};break;

case 7:
{
Mayor_Indice();
};break;

case 8:
{
Menor_Indice();
};break;

case 9:
{
Matriz_Identidad();
};break;

case 10:
{
Promedio_de_la_Suma();
};break;

case 11:
{
Multiplicacion_de_Matrices() ;
};break;

}//fin switch
}while (opcion=!0);
 system ("pouse") ;
 return 0;
}
//Zona de Funciones
//caso 1
double Leer_Matriz()
{
  for( i = 1 ; i <= 4 ; i++ )
  for( j = 1 ; j <= 4 ; j++ )
{
 cout<<"La matriz   M["<<i<<"]["<<j<<"]"<<" es = "; cin>> M [i] [j];
}
}
//Caso 2
double Ver_Matriz()
 {
  cout<<" La matriz   "<<endl;
 for ( i = 1 ; i <= 4 ; i++ )
 {

 for ( j=1 ; j <= 4 ; j++ )
 {
 cout<<" M ["<<i<<"]["<<j<<"] "<<"=" << M [i] [j]<<endl;
 }
 cout<<endl;
}
 }
 //Caso 3
double Leer_2_Matrices()
{
  cout<<" Ingrese la Matriz A[] "<<endl;
  for ( i = 1 ; i <= 4 ; i++)
  for ( j = 1 ; j <= 4 ; j++)
  {

 cout<<" La matriz A ["<<i<<"]["<<j<<"]"<<" es = "; cin>>A [i] [j] ;

  }
  cout<<" Ingrese la Matriz B[]"<<endl;
  for( i = 1 ; i <= 4 ; i ++)
  for( j = 1 ; j <= 4 ; j ++)
  {
   cout<<" La matriz B ["<<i<<"]["<<j<<"]"<<" es = "; cin>>B [i] [j];
  }
}
//Caso 4
double Sumar_2_Matrices()
{
 cout<<" La Suma de las Matrices A[] + B[] ES = "<<endl;
  cout<<endl;
   for ( i = 1 ; i <= 4 ; i++)
  {

   for ( j = 1 ; j <= 4 ; j++)
   {
   C [i] [j] = A [i] [j] + B [i] [j] ;
   cout<<" A+B["<<i<<"]["<<j<<"]"<<" = "<<C [i] [j]<<endl;
  }
  cout<<endl;
 }
}
//Caso 5
double Restar_2_Matrices()
{
 cout<<" La Resta de las Matrices A[] + B[] ES = "<<endl;
  cout<<endl;
   for ( i = 1 ; i <= 4 ; i++)
  {

   for ( j = 1 ; j <= 4 ; j++)
   {
   N [i] [j] = A [i] [j] - B [i] [j] ;
   cout<<" A-B["<<i<<"]["<<j<<"]"<<" = "<<N [i] [j]<<endl;
  }
  cout<<endl;
 }
}

//Caso 6
double Tanspuesta()
{
cout<<" La Tanspuesta de la Matriz C es :  "<<endl;
 for ( i = 1 ; i <= 4 ; i++ )
 {

 for ( j = 1 ; j <= 4 ; j++ )
 {
 cout<<" A+B Tanspuesta ["<<j<<"]["<<i<<"] "<<"=" << C [i] [j] ;
 }
 cout<<endl;
}
}
//Caso 7
double Mayor_Indice()
{
 for ( i = 1 ; i <= 4 ; i++)
 for ( j = 1 ; j <= 4 ; j++)
 {

  if ( C [i] [j] >=MAX)
  {
  MAX = C [i] [j] ;
  IND=ij;
        }
 }
 cout<<" El Maximo Valor se Encuentra en  = ""C["<<i<<"]["<<j<<"]"<<" es = "<<MAX<<endl;
}
//Caso 8
double Menor_Indice()
{
MIN = C [i] [j] ;

 for ( i = 1 ; i <= 4 ; i++)
 for( j = 1 ; j <= 4 ; j++)
 {

  if( C [i] [j] <= MAX )
  {
  MIN = C [i] [j] ;
  IND = ij;
        }
    }
    cout<<" EL Minimo Valor se Encuentra en  = ""C["<<i<<"]["<<j<<"]"<<" es = "<<MIN<<endl;
}
//Caso 9
double Matriz_Identidad()
{
 cout<<"    \n    Matriz Identidad \n";
 for ( i = 1 ; i <= 4 ; i++)
 {
  for( j = 1 ; j <= 4 ; j++)
  {
   if(i==j)
   {
    I [i] [j] = 1 ;
   }
   if ( i != j)
   {
    I [i] [j] = 0 ;
   }
   cout<<"  I["<<i<<"]["<<j<<"] = "<<I [i] [j] ;
  }
  cout<<endl;
 }
}
//Caso 10
double Promedio_de_la_Suma()
{
 Suma = 0 ;
for( i = 1 ; i <= 4 ; i++ )
for( j = 1 ; j <= 4 ; j++ )
Suma = Suma + C [i] [j];
Prom = Suma / ( i * j );
cout<<" El Promedio de la Suma es : "<<Prom<<endl;
}
//Caso 11
double Multiplicacion_de_Matrices()
{
    cout<<" La Multiplicacion de la Matriz A[] y la matriz B[] es = "<<endl;
 for ( i = 1 ; i <= 3 ; i++)
 {
 for ( j = 1 ; j <= 3 ; j++)
 {
  for(z=1;z<=3;z++)
  {
  Mu [i] [j] = Mu[i][j]*a[i][z]*b[z][j] ;
 cout<<" A*B["<<i<<"]["<<j<<"]"<<" = "<<Mu[i][j];
}

 }
 cout<<endl;
   }
}

No hay comentarios:

Publicar un comentario