English
English
Slovensky
Slovensky
Česky
Česky
Šarišsky
Šarišsky
 
Kategorija: Programy zos Pascalu (KMP)

Zrobil: Lukáš Hlousek
Program: Inpstr.pas
Vstup z klávesnice s omedzením počtu znakov.
Kuklo še: 1819x


{ INPSTR.PAS                            Copyright (c) Lukas Hlousek }
{ Vstup z klavesnice s omezenim poctu znaku.                        }
{                                                                   }
{ Datum:10.01.2007                             http://www.trsek.com }
 
uses Crt;
 
const
  CR=#13;
  BS=#8;
  Num=['0','1','2','3','4','5','6','7','8','9'];
 
var
  InpBuf: string;
  InpChr: char;
  MaxLen: byte;
 
begin
  MaxLen:=8;
  ClrScr;
  InpChr:=#0;
  InpBuf:='';
  while InpChr<>#13 do
  begin
    InpChr:=ReadKey;
    case InpChr of
      BS: Delete(InpBuf,Length(InpBuf),1);
    else
      if (Length(InpBuf)<MaxLen) AND (InpChr in Num)
        then InpBuf:=InpBuf+InpChr;
    end;
    GotoXY(1,1);
    ClrEol;
    Write(InpBuf);
  end;
end.
 

[Ulož] [Ciskaj] [Naj idze meilom]