hola, tengo que desplazar un cursor con las flechas en una matriz, pero no se usar el gotoxy
1 0 0 0 0 0
[ 2 ] 1 0 0 0 0
1 2 0 0 0 0
1 3 1 0 0 0
2 0 3 0 0 0
0 3 0 0 0 0
Este es mi procedimiento para detectar que hemos pulsado
procedure accion(var m:tmatriz; c:char; var x,y:integer);
const
FLECHADERECHA = 'L';
FLECHAIZQUIERDA = 'J';
FLECHAARRIBA = 'I';
FLECHAABAJO = 'K';
SALTOH=2;
SALTOV=2;
begin
case c of
FLECHADERECHA: begin
x:=(x+SALTOH);
escribirm(m,x,y);
end;
FLECHAIZQUIERDA:
begin
x:=(x-SALTOH);
escribirm(m,x,y);
end;
FLECHAARRIBA:
begin
y:=(y+SALTOV);
escribirm(m,x,y);
end;
FLECHAABAJO:
begin
y:=(y-SALTOV);
escribirm(m,x,y);
end;
#13: modificar(m,x,y);
end;
end;
Pero en el procedimiento escribir matriz la deja igual, no puedo desplazarme, no se porque.
Este es el procedimiento escribir matriz
procedure escribirm(var m:tmatriz; x,y:integer);
var
i,j:integer;
begin
x:=x+1;
y:=y+1;
for i:=2 to fil+1 do
begin
for j:=2 to col+1 do
begin
if (i=x) and (j=y) then
write('[':3, m[i,j] ,']')
else
write(m[i,j]:4);
end;
writeln();
end;
end;
Si sabeis cual es mi error o si hay otra forma mejor de hacerlo responder.
gracias.
Sudafrica 2010
################################
################################
################################
################################
Bueno, tras unos dias dandole vueltas, puedo decir:
SOLUCIONADOOOOOOO
Sudafrica 2010
################################
################################
################################
################################
Cerrado

Volver a “Otros lenguajes”