Pascal/Turbo Pascal - asterisco en el centro de la pantalla para deplazarlo

 
Vista:

asterisco en el centro de la pantalla para deplazarlo

Publicado por Edna Barrios (1 intervención) el 14/03/2012 03:24:24
me dejaron de tarea un progra de escribir un asterisco en el centro de la pantalla y permita que el usuario lo desplace utilizando las flechas....!!! como hacerlo
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

asterisco en el centro de la pantalla para deplazarlo

Publicado por ramon (2158 intervenciones) el 14/03/2012 17:33:43
{A qui lo tienes fácil no}

program esterisc;
uses
crt;
const
steri = '*';
var
tecla : char;
x, y : integer;

procedure ponsteri(x1, y1 : integer; pres : boolean);
begin
if pres = true then
begin
gotoxy(x1,y1);write(steri);
end
else
begin
gotoxy(x1,y1);write(' ');
end;
end;

begin
clrscr;
x := 40;
y := 11;
gotoxy(24,1);write('Tecla [ESC] salir teclas [',chr(24),chr(25),
chr(26),chr(27),'] Mueven');
ponsteri(x,y,true);
repeat
ponsteri(x,y,true);
tecla := readkey;
ponsteri(x,y,false);
if tecla = #80 then
begin
y := y + 1;
if y > 22 then
y := 22;
end;
if tecla = #72 then
begin
y := y - 1;
if y < 2 then
y := 2;
end;
if tecla = #77 then
begin
x := x + 1;
if x > 79 then
x := 79;
end;
if tecla = #75 then
begin
x := x - 1;
if x < 1 then
x := 1;
end;
until tecla = #27;
end.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar