Program roll entered text from right to left on screen

Delphi & Pascal (česká wiki)
Přejít na: navigace, hledání
Category: Homework in Pascal

Author: Peter
Program: Veta.pas
File exe: Veta.exe

Program roll entered text from right to left on screen.
{ VETA.PAS                                      Copyright (c) Peter }
{ Program roluje zadany text.                                       }
{                                                                   }
{ Datum:13.01.2007                             http://www.trsek.com }
 
program vetaa;
uses crt;
var veta,v1,v2:string;
    x,y,dlzka,d:byte;
 
begin
  clrscr;
  write('Zadaj text: '); readln(veta);
  clrscr;
  x:=4; y:=10;
  dlzka:= length(veta);
  d:=0;
  repeat
    if d>0 then
           begin
           v1:=copy(veta, 1, d);
           v2:=copy(veta,d+1, dlzka);
           gotoxy(1,y); write(v2,' ');
           gotoxy(79-d,y); write(v1);
           d:=d+1;
           if d=dlzka+1 then begin x:=79-d; d:=0; end;
           end
       else
           begin
           gotoxy(x,y);
           write(veta, ' ');
           x:=x-1;
           if x=0 then d:=1;
           end;
 
    delay(60);
  until keypressed;
 
  readln;
end.