{$mode objfpc}{$H-}{$R+}{$T+}{$Q+}{$V+}{$D+}{$X-}{$warnings on}
program todos_mayores;
// Indica si en una matriz de reales todos los números son 
//mayores que K
uses crt;  // Necesario para delay
const
    Filas = 3; 
    Columnas = 5;
type
    TipoMatriz = array[1..Filas, 1..Columnas] of real;


function genera_real(cota_superior:real):real;
begin
    result := random() * cota_superior;
end;


procedure inicia_matriz(var matriz:TipoMatriz; cota_superior: real);
var
    i,j : integer;
begin
    for i := 1 to Filas do
        for j:= 1 to Columnas do
            matriz[i,j] := genera_real(cota_superior);
end;


procedure escribe_matriz(matriz:TipoMatriz);
var i,j: integer;   
begin
    for i := 1 to Filas do begin
        for j:= 1 to Columnas do 
            write(matriz[i,j]:6:2);
        writeln;
    end;
end;


function todos_mayores(matriz: TipoMatriz;k: real): boolean;
var
    i,j: integer;
begin
    result := True;  // De momento todos son mayores
    for i:= 1 to Filas do
        for j:= 1 to Columnas do
            if  matriz[i,j] <= k then
                result := False;
end;


var
    matriz : TipoMatriz;
const
    CotaSuperior  =  10 ;
    K = 1.0;
begin
    randomize();
    delay(800);
    inicia_matriz(matriz, CotaSuperior);
    escribe_matriz(matriz);
    if todos_mayores(matriz, K) then
        writeln('Todos los valores son mayores que ',K:4:2)
    else
        writeln('No todos los valores son mayores que ',K:4:2)
end.  
