implementation of a stack in Object Pascal
A stack coded in Object Pascal. Works with FreePascal and Delphi.
AI
Podsumowanie AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Kod źródłowy
{ implementation of a stack in Object Pascal
written by Jared Bruni
www.LostSideDead.com
}
program stack;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
array_stack: array [0..255] of string;
pos: integer = 0;
s: string;
i: integer;
procedure push(str: string);
begin
array_stack[pos] := str;
inc(pos);
end;
function pop(): string ;
begin
dec(pos);
result := array_stack[pos];
end;
function get(at: integer): string;
begin
result := array_stack[at];
end;
function size(): integer;
begin
result := pos;
end;
begin
push('hello');
push('world');
push('stack');
push('in pascal');
push(':)');
for i := 0 to size() do begin
writeln(get(i));
end;
read(s);
end.
Oryginalne komentarze (3)
Odzyskane z Wayback Machine