Monday, December 10, 2012

Tugas Pascal Moving Text

Program berikut ini akan membuat tulisan berjalan ke samping lalu ke bawah :

uses crt;
var
a,b:string;
i,j:integer;
x,y:byte;
begin
j:=45;
clrscr;
a:='HELLO WORLD';
for i:=length(a) downto 1 do
    begin
    j:=j-1;x:=1;y:=1;
    b:=copy(a,i,1);
    repeat
        delay(20);
        gotoxy(x,y);write(b);
        gotoxy(x-1,y);write(' ');
        x:=x+1;
        until x>j;
    end;
x:=44;
for i:=length(a) downto 1 do
    begin
    for y:=1 to 20 do
        begin
        gotoxy(x,y);write(A[i]);
        gotoxy(x,y-1);write(' ');
        delay(20);
        end;
    x:=x-1;
    delay(50);
    end;
readln;
end.

No comments:

Post a Comment