Tema: Pascal
Ver Mensaje Individual
  #8  
Antiguo 26-02-2008
D.M.Nieto D.M.Nieto is offline
Registrado
 
Registrado: feb 2008
Posts: 5
Reputación: 0
D.M.Nieto Va por buen camino
Matriz resuelta

Buenasss, ya resolvimos el tema de la matriz con este código pero me han dicho que queda mas elegante usando continuamente MOD. Os lo pongo por aquí por curiosidad oprque ya estoy con otro ejercicio jeje.

Código Delphi [-]
const
 N=27;
 A=10;
type
 t_matriz=array[1..n,1..n] of integer;
var
 numero:integer;
procedure comprueba (numero:integer);
 var
  ok:boolean;
begin
  ok:=false;
  if numero>=27 then begin
  repeat
   writeln('el numero introducido es mayor que 27');
   writeln('introduza un numero de nuevo');
   readln(numero);
   if numerothen begin
    writeln('numero introducido es correcto');
    ok:=true;
   end
  until(ok=true);
  end;
  end;
  var
  y,x1: integer;
begin
  writeln('introduzca el tamanio de la matriz[menor a 27]');
  readln(numero);
  comprueba(numero);
 for x1:=1 to numero do
 begin
  writeln;
  for y:=1 to numero do
  begin
  if (x1+y-1)>numero then
    write (chr(96 + (x1+y-1)-numero))
  else
   write (chr (96 + (x1+y-1)));
    end;
  end;
  writeln;
  writeln;
  writeln('Pulse una tecla para finalizar');
  readln;
end.

Saludoss

Última edición por dec fecha: 26-02-2008 a las 16:29:59.
Responder Con Cita