Написать программу вывода на экрана системного текущего времени, с движением его вверх —

program Project1;
 
uses
  Dos, Crt;
 
var
  Hour, Minute, Second, Sec100 : Word;
begin
  Writeln('Для выхода нажмите любую клавишу.');
 
  while not KeyPressed do begin
    GetTime(Hour, Minute, Second, Sec100);
    Writeln(Hour:2, ':', Minute:2, ':', Second:2);
    Delay(300);
  end;
 
  Readln;
end.

Следующий вариант

uses Dos,Crt;
var
  i, Hour, Minute, Second, Sec100 : Word;
begin
clrscr;
Writeln('Для выхода нажмите любую клавишу.');
i := 25;
while not KeyPressed do
 begin
  dec(i);
  GetTime(Hour, Minute, Second, Sec100);
  gotoXY(36,i);
  if hour<10 then write('0',hour)else write(hour);
  if minute<10 then write(':0',minute)else write(':',minute);
  if second<10 then write(':0',second)else write(':',second);
  Delay(1000);
  clrscr;
  if i=1 then
    begin
     i:=25;
     Writeln('Для выхода нажмите любую клавишу.');
    end;
 end;
Readkey;
end.

Следующий вариант

 
uses WinDos,CRT;
  var
   h,m,s,hund: word;
   y:integer;
function LeadingZero(w:word):string;
    var 
      S: string;
    begin
      Str(W:0,S);
       if lenght(S)= 1 then
        S:= '0' + S;
     LeadingZero := S;
   end;
 begin
  clrscr;
  repeat  
   for y:=25 downto 1 do
    begin
     GoToXY(1,y);
     GetTime(H,M,S,Hund);
     write('Сейчас ', LeadingZero(H),':',LeadingZero(M),':',leadingzero(S);
     Delay(100);
     clrscr;
    end;
until Keypressed;
end.

Leave a Comment

+ 18 = 25