After observing the code in this post (Stacks) , implement a stack with a maximum size of 5 elements using flowgorithm.
The program must continuously prompt the user for an option:
push -if the user enters push, prompt the user to enter an integer and push it onto the stack
pop -if the user enters pop, display the integer at the top of the stack and remove it
peek – If the user enters peek, display the integer at the top of the stack
exit – exits the program.
Ensure that the program works in all cases, e.g if the stack is full and and the user tries pushing another element, display an appropriate error message.
© 2020 Vedesh Kungebeharry. All rights reserved.
One thought on “Stack Operations (Exercise)”
[…] The prerequisite post which was an exercise in creating a stack from previously supplied code. It is imperative that you complete the tasks from that post found here: Stack Operations (Exercise) […]