uses crt;
var Active : Integer; {позиция курсора}
s : string; {рабочая строка}
ch : char; {для посимвольной считки}
begin
writeln ('Vvedite stroku');
S:='' ;
Active:=1; {1, ведь изначально курсор после символа}
repeat
Clrscr;
Write (s);
read (ch);
if (ord(ch) = 8) and (Length(S) <> 0) then {BACKSPASE}
begin
gotoXY(WhereX - 1, Wherey);
Active:=Active - 1;
Delete (s,Active,Length(s));
end else
if (ord(ch) = 75) and (Length(S) <> 0 ) then {LEFT}
begin
gotoXY(whereX - 1, WhereY);
Active:=Active - 1;
end
else
if ord(ch) = 77 then {RIGHT}
begin
gotoXY(wherex + 1, Wherey);
Active:=Active + 1;
end
else
If (Active <= Length(s)) and (ch In ['a'..'z']) then Insert (ch,s,active) {INSERT}
else
if (Active <=Length(s)) and (ord(ch) = 83) then Delete (s,Active,1); {DELETE}
if Active = Length(s) then S:= S + Ch;
until ord(ch) = 13;
end.
Сообщение отредактировано: Tan -