Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
24
Task/Stack/Delphi/stack.pas
Normal file
24
Task/Stack/Delphi/stack.pas
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
program Stack;
|
||||
|
||||
{$APPTYPE CONSOLE}
|
||||
|
||||
uses Generics.Collections;
|
||||
|
||||
var
|
||||
lStack: TStack<Integer>;
|
||||
begin
|
||||
lStack := TStack<Integer>.Create;
|
||||
try
|
||||
lStack.Push(1);
|
||||
lStack.Push(2);
|
||||
lStack.Push(3);
|
||||
Assert(lStack.Peek = 3); // 3 should be at the top of the stack
|
||||
|
||||
Writeln(lStack.Pop); // 3
|
||||
Writeln(lStack.Pop); // 2
|
||||
Writeln(lStack.Pop); // 1
|
||||
Assert(lStack.Count = 0); // should be empty
|
||||
finally
|
||||
lStack.Free;
|
||||
end;
|
||||
end.
|
||||
Loading…
Add table
Add a link
Reference in a new issue