Advertisement
Guest User

Untitled

a guest
Mar 16th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ada 0.48 KB | None | 0 0
  1. package body pila is
  2.    
  3.    top : Integer := 0;
  4.    stack: array (1..100) of Integer;
  5.    
  6.    function Empty return Boolean is
  7.    begin
  8.       return top = 0;
  9.    end Empty;
  10.    
  11.    procedure Push(E:Elemento) is
  12.    begin
  13.       if (top /= 100) then
  14.          top := top + 1;
  15.          stack(top) := Integer(E);
  16.       end if;
  17.    end Push;
  18.    
  19.    procedure Pop(E: out Elemento) is
  20.    begin
  21.       E := Elemento(stack(top));
  22.       top := top - 1;
  23.    end Pop;
  24.    
  25.  
  26. end pila;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement