12 Matriz = array [1..MAX_FILAS, 1..MAX_COLUMNAS] of integer;
\r
13 Vector = array [1..MAX_FILAS+MAX_COLUMNAS] of Datos;
\r
16 (*****************************************************)
\r
18 procedure visualiza(var m: Matriz; titulo: String);
\r
26 for i := 1 to MAX_FILAS do begin
\r
27 for j := 1 to MAX_COLUMNAS do
\r
28 write(' ', m[i,j]: 8);
\r
34 (*****************************************************)
\r
36 procedure leerDatos(var m: Matriz);
\r
40 i, j, k, code: integer;
\r
44 assign(f, 'datos.txt');
\r
48 while (not eof(f)) and (i <= MAX_FILAS) and (j <= MAX_COLUMNAS) do begin
\r
51 if code <> 0 then begin
\r
52 Writeln('Error en la posici¢n: ', Code);
\r
56 if j < MAX_COLUMNAS then
\r
66 (*****************************************************)
\r
68 function buscarMayor(var m: Matriz): integer;
\r
75 for i := 1 to MAX_FILAS do
\r
76 for j := 1 to MAX_COLUMNAS do
\r
77 if m[i,j] > max then
\r
80 end; { buscarMayor }
\r
82 (*****************************************************)
\r
84 procedure buscarIndices(var m: Matriz; max: integer; var indices: Vector);
\r
91 for i := 1 to MAX_FILAS do
\r
92 for j := 1 to MAX_COLUMNAS do
\r
93 if m[i,j] = max then begin
\r
98 end; { buscarIndices }
\r
100 (*****************************************************)
\r
109 visualiza(m, 'Datos');
\r
111 max := buscarMayor(m);
\r
112 writeln(' Valor Maximo: ', max);
\r
113 writeln(' Se encuantra en los indices: ');
\r
114 buscarIndices(m, max, indices);
\r
115 for i := 1 to MAX_FILAS + MAX_COLUMNAS do
\r
116 if (indices[i].i > 0) and (indices[i].j > 0) then
\r
117 writeln(' | ', indices[i].i, ' | ', indices[i].j, ' |')
\r