{Dynamicky alokovane pole, pretizene funkce} unit DArray; interface procedure StackInit; procedure StackPush(ch : char); overload; procedure StackPush(text : string); overload; procedure StackPushAll(a : array of char); //procedura s jibovolnym poctem argumentu typu char function StackPop : char; function StackIsEmpty : Boolean; function StackGet(i : integer = 0): char; //i-ty prvek od vrcholu zasobniku, defaultni hodnota implementation var Stack : array of char; procedure StackInit; begin setlength(Stack,0); end; procedure StackPush(ch : char); begin SetLength(Stack,Length(Stack)+1); Stack[High(Stack)] := ch; //high je to same jako lenght(Stack) - 1 end; procedure StackPush(text : string); var i : integer; begin for i:=1 to Length(text) do StackPush(text[i]); end; procedure StackPushAll(a : array of char); var i : integer; begin for i:=0 to high(a) do StackPush(a[i]); end; function StackPop : char; begin StackPop := Stack[High(Stack)]; SetLength(Stack,Length(Stack)-1); end; function StackIsEmpty : Boolean; begin StackIsEmpty := Length(Stack) = 0; end; function StackGet(i:integer):char; begin StackGet := Stack[High(Stack)-i]; end; end.