Nadezhda
?>

Отинем комектесиндерши нужно)​

Информатика

Ответы

markitandl

const

      MAX = 20;

    var

      s:string;

      stack:array[1..MAX] of string;

      top:integer;

      i:byte;

   

    procedure Push(ch:string);

    begin

      if top>=MAX then WriteLn('Stask full')

      else

      begin

        stack[top]:=ch;

        top:=top+1;

      end;

    end;

   

    function Pop:string;

    begin

      top:=top-1;

      if top<1 then

      begin

        WriteLn('Stack underflow');

        top:=top+1;

      end

      else Pop := stack[top];

    end;

begin

top:=1;

s:='<asdf<asdf>asdf>';//правильная строка

for i:=1 to length(s) do

begin

   if s[i]='<' then Push('<');

   if s[i]='>' then

       if Pop()<>'<' then WriteLn('Ошибка!');

end;

if top<>1 then WriteLn('Ошибка!');

top:=1;

s:='<asdf<asdfasdf>';//не правильная строка

for i:=1 to length(s) do

begin

   if s[i]='<' then Push('<');

   if s[i]='>' then

     if Pop()<>'<' then WriteLn('Ошибка!');

end;

if top<>1 then WriteLn('Ошибка!');

end.

Объяснение:

Ответить на вопрос

Поделитесь своими знаниями, ответьте на вопрос:

Отинем комектесиндерши нужно)​
Ваше имя (никнейм)*
Email*
Комментарий*

Популярные вопросы в разделе

Irina1435
Шеина
laleonaretouch
Natalya1895
nat5555
neganovaarxi
Milovidova
vadimnechaev23150
Kulikovvl9
Баканова1415
Иванович621
osnickyi
mberberoglu17
nchorich55
Chopper-hinter25