LAB 3.

#include <iostream>
#include <cstdlib>

//Declaracion de los Using
using namespace std;

//Inicion Funcion MAIN del Programa
int main() 
{
//Declaracion de las Variables
int fila,columna;
int matriz[10][10];

//Ingreso de la cantidad de filas y columna 
cout << "Ingrese la cantidad de Filas: " ;
cin >> fila; 
cout << "Ingrese la cantidad de Columna: " ;
cin >> columna; 

//Cambio de tamaño en la matriz (esto es la parte que no termino de comprender)
matriz[1][1]=matriz[fila][columna]; 

//Muestra del nuevo tamaño de la matriz
cout << "\nLa nueva matriz es de " << fila << "x" << columna << "\n\n";

//Ingreso de los componentes de la matriz 
for(int i=0;i<fila;i++)

for(int n=0;n<columna;n++)
{
cout << "Ingrese el valor de [" << i+1 << "][" << n+1 << "] : " ;
cin >> matriz[i][n];



//Muestra de la matriz ingresa
cout << "\nLa matriz guardada es \n\n"; 

for(int i = 0; i < fila; i++)
{
for(int n = 0; n < columna; n++)

cout << matriz[i][n]; 

cout << endl; 



system("pause<nul"); 
return 0;
}

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

const int TAM_N=3, TAM_M=3;
int i,j,c,d, min ,max , Elemento, Matriz[TAM_N][TAM_M],A[TAM_N][TAM_M],B[TAM_N][TAM_M];
void ingreso ();
void lectura ();
int maximo ();
int minimo();
int suma();
int determinante();


int main()

{
// 1) DECLARACION

int opcion;
do
{
cout<<"\n *******************  MENU PRINCIPAL ********************* \n\n";
cout<<" 1) LECTURA DE LONGITUD DEL CONDUCTOR \n ";
cout<<"2) IMPRESION O ESCRITURA DE LA LONGITUD DEL CONDUCTOR \n ";
cout<<"3) PROCESAR LA MAXIMA LONGITUD \n ";
cout<<"4) PROCESAR LA MINIMA LONGITUD \n ";
cout<<"5) SUMA DE lAS ELEMENTOS DE LA MATRIZ\n ";
cout<<"6) DETERMINANTE DE UNA MATRIZ\n ";
cout<<" DIGITE <0> PARA SALIR \n\n ";
cout<<"********************************************************* \n\n";
cout<<"      INGRESE UNA OPCION : ";  cin>>opcion;


switch (opcion)
{
  case 1:
   {
    cout<<"\n ***************** LECTURA DE LONGITUD DEL CONDUCTOR *******************\n\n";
    ingreso ();//LLAMADO
    cout<<endl;
    cout<<" ********************************************************* \n\n";
   }//FIN DEL CASO 1
   break;
  
   case 2:
   {
    cout<<"\n ************ IMPRESION O ESCRITURA DE LA LONGITUD DEL CONDUCTOR ***********\n\n";
    lectura ();//LLAMADO
    cout<<endl;
    cout<<" ********************************************************* \n\n";
   }//FIN DEL CASO 2
  break;
 
  case 3:
  {    
    cout<<"\n ****************** PROCESAR LA MAXIMA LONGITUD *******************\n\n";
    maximo ();//LLAMADO
    cout<<endl;
    cout<<"\n ********************************************************* \n\n";
  }//FIN DEL CASO 3
  break;
 
   case 4:
  {   
    cout<<"\n ****************** PROCESAR EL MINIMA LONGITUD *******************\n\n";
    minimo();//LLAMADO
    cout<<endl;
    cout<<"\n ********************************************************* \n\n";
  }//FIN DEL CASO 4
 
  case 5:
  {   
  cout<<"\n ************ SUMA DE ELEMENTOS DEL VECTOR **************\n";
  suma();//LLAMADO
  cout<<endl;
  cout<<"\n ********************************************************* \n\n";
  }//FIN DEL CASO 5
  break;
 
  case 6:
  {
  cout<<"\n ************** DETERMINANTE DE UNA MATRIZ **************\n\n";
  determinante();
  cout<<endl;
  cout<<endl;
  cout<<" ********************************************************* \n\n";
  }//FIN DEL CASO 6
 
   
  break;
} // FIN DEL SWITCH
}
while (opcion !=0);

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

//ZONA DE DESARROLLO

void ingreso ()
{
    for (i=1;i<=TAM_N;i++)
    for (j=1;j<=TAM_M;j++)
    {
    cout<<" INGRESE EL ELEMENTO M["<<i<<","<<j<<"]= ";cin>> Matriz[i][j];
    }
}

void lectura ()
{
    for (i=1;i<=TAM_N;i++)
    for (j=1;j<=TAM_M;j++)
   
     cout<<" EL ELEMENTO M["<<i<<","<<j<<"] : "<< Matriz[i][j]<<endl;  
   
}

int maximo ()
{
    int max=0;
    for (i=1;i<=TAM_N;i++)
    for (j=1;j<=TAM_M;j++)
    {
        if(Matriz[i][j]>max)
        max = Matriz[i][j];
    }
    cout<<" EL MAXIMO DE LOS ELEMENTOS DE LA MATRIZ ES : "<<max;

}

int minimo ()
{
    int min=1000;
    for (i=1;i<=TAM_N;i++)
    for (j=1;j<=TAM_M;j++)
    {
        if(Matriz[i][j]<min)
        min = Matriz[i][j];
    }
    cout<<" EL MINIMO DE LOS ELEMENTOS DE LA MATRIZ ES : "<<min;
}

int suma ()
{
     int suma =0;
     for (i=1;i<=TAM_N;i++)
     for (j=1;j<=TAM_M;j++)
     suma=suma+Matriz[i][j];
     cout<<" \n --------------------------------------------------------\n";
     cout<<"\n LA SUMA DE ELEMENTOS DE LA MATRIZ ES :"<<suma<<endl;
}

int determinante()
{
  d=((Matriz[1][1]*Matriz[2][2]*Matriz[3][3])+(Matriz[1][2]*Matriz[2][3]*Matriz[3][1])+(Matriz[1][3]*Matriz[2][1]*Matriz[3][2])-(Matriz[3][1]*Matriz[2][2]*Matriz[1][3])-(Matriz[3][2]*Matriz[2][3]*Matriz[1][1])-(Matriz[3][3]*Matriz[2][1]*Matriz[1][2]));
  cout<<endl;
  cout<<" LA DETERMINANTES ES :"<<d<<endl;
}

https://drive.google.com/file/d/0B2UWmzCeqrlmSzhDcG12MnppZk0/view?usp=sharing

No hay comentarios:

Publicar un comentario