Advertisement
Guest User

Untitled

a guest
Nov 18th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. //FUNCION PARA CÁLCULO DE POSICION MÁXIMO DE LOS MÍNIMOS DE CADA FILA
  2. double MaximoMinor(int filas, int columnas, double Matriz[20][20]){
  3.     int pos_i = 1, pos_j = 7;
  4.     int minimo_fila = 0, candidato_min = 0;
  5.     int maxmin = 0, candidato_maxmin = 0;
  6.     int i = 0, j = 0;
  7.    
  8.     minimo_fila = Matriz[0][0];
  9.    
  10.     while(i < filas){
  11.         for(int j=0; j<columnas; j++){
  12.             candidato_min = Matriz[i][j];
  13.             if(minimo_fila > candidato_min){
  14.                 minimo_fila = candidato_min;
  15.             }
  16.             candidato_maxmin = minimo_fila;
  17.         }
  18.         if(candidato_maxmin > maxmin){
  19.             maxmin = candidato_maxmin;
  20.         }
  21.         i++;
  22.     }
  23.     i = 0;
  24.     while(i < filas){
  25.         for(int j=0; j<columnas; j++){
  26.             if(Matriz[i][j] == maxmin){
  27.                 pos_i = i;
  28.                 pos_j = j;
  29.             }
  30.         }
  31.         i++;
  32.     }
  33.    
  34.     cout << maxmin << "\n";
  35.     cout << pos_i << pos_j;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement