stacktest - push (name, ch); ReadInt(ch); END; WriteLn;

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
MODULE stacktest; FROM stackadt IMPORT stack, define, makempty, empty, push, pop, topstack; FROM elements IMPORT elementtype; FROM InOut IMPORT WriteInt, WriteLn, Write, WriteString, ReadInt, Read; VAR name: stack; ch : elementtype; BEGIN define (name); WriteLn; WriteString("Input some integers (0 to finish): "); WriteLn; ReadInt(ch); WHILE ch# 0 DO
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: push (name, ch); ReadInt(ch); END; WriteLn; WriteString("the item at the top of the stack is: "); WriteLn; WriteInt(topstack (name),5); WriteLn; WriteString("Your items in reverse order are: "); WriteLn; WHILE NOT empty (name) DO pop (name, ch); WriteInt(ch,5); WriteLn; END; makempty(name); END stacktest....
View Full Document

Ask a homework question - tutors are online