Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package body cola is
- type nodo;
- type enlace is access nodo;
- type nodo is
- record
- contenido :Elemento;
- siguiente : enlace;
- end record;
- primero, ultimo : enlace;
- function vacia return boolean is
- begin
- return primero = null;
- end vacia;
- procedure poner (E: elemento) is
- nuevo: enlace;
- begin
- nuevo:= new nodo;
- Nuevo.contenido:=E;
- Nuevo.siguiente:=null;
- if vacia then
- primero:=nuevo;
- else
- Ultimo.siguiente:= nuevo;
- end if;
- ultimo:=Nuevo;
- end poner;
- procedure quitar(E: out elemento) is
- viejo: enlace;
- begin
- viejo:=Primero;
- E:=viejo.contenido;
- Primero:=viejo.siguiente;
- if primero = null then
- ultimo:= null;
- end if;
- end quitar;
- end cola;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement