Скачиваний:
17
Добавлен:
08.01.2014
Размер:
977 б
Скачать
(* ч ЬФПН ЖБКМЕ ПРТЕДЕМЕОЩ isspace Й isalnum *)
uses stdio;

const
MAXTOK=256;

var
inbuf:array [0..MAXTOK] of char;


function getword (inf:pfile):pchar;
var
c,count:integer;
begin
count:=0;
(* хДБМЙФШ РТПВЕМШОЩЕ УЙНЧПМЩ *)
repeat
c := getc (inf);
until not isspace (c);
if c = EOF then
begin
getword:=nil;
exit;
end;
if not isalnum (c) then (* УЙНЧПМ ОЕ СЧМСЕФУС БМЖБЧЙФОП-ГЙЖТПЧЩН *)
begin
inbuf[count] := char(c);
inc(count);
end
else
begin
(* уВПТЛБ "УМПЧБ" *)
repeat
if count < MAXTOK then
begin
inbuf[count] := char(c);
inc(count);
end;
c := getc (inf);
until not isalnum (c);
ungetc (c, inf); (* ЧЕТОХФШ УЙНЧПМ *)
end;
inbuf[count] := #0;
(* ОХМЕЧПК УЙНЧПМ Ч ЛПОГЕ УФТПЛЙ *)
getword:=inbuf;
end;


var
word:pchar;
begin
while true do
begin
word := getword (stdin);
if word <> nil then
puts (word)
else
break;
end;
end.
Соседние файлы в папке 11