Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
24
Task/Stack/Delphi/stack.delphi
Normal file
24
Task/Stack/Delphi/stack.delphi
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