
Dynamic Stack
5167
$50
- Posted:
- Proposals: 3
- Remote
- #137984
- Archived
Description
Experience Level: Intermediate
Write a program that implements a dynamic stack using singly-linked nodes. The stack will hold words in a dictionary. Your program should have a command line interface that recognizes the following commands: push , pop, display and exit. Use only 1 global variable, a pointer to the top of your linked nodes. This way you won't have to pass the stack to your functions and their signatures will match standard Stack function signatures. You will need to tokenize the user's input to execute the correct command. Your program should loop continuously until the user enters exit.
The push command should add to the top of the stack. Since this stack can grow dynamically, there is no need to check if the stack is full.
If the user does not include a string along with the push command, do not push anything onto the stack and display an error message.
The pop command should remove the last element added to the stack and print it followed by a newline. If the stack is empty, an error message should display.
The display command should print the entire stack starting from the top. Each element should be on a separate line followed by a newline. If the stack is empty, then an appropriate message should be printed.
The exit command will terminate the program.
The push command should add to the top of the stack. Since this stack can grow dynamically, there is no need to check if the stack is full.
If the user does not include a string along with the push command, do not push anything onto the stack and display an error message.
The pop command should remove the last element added to the stack and print it followed by a newline. If the stack is empty, an error message should display.
The display command should print the entire stack starting from the top. Each element should be on a separate line followed by a newline. If the stack is empty, then an appropriate message should be printed.
The exit command will terminate the program.
Thomas P.
0% (0)Projects Completed
-
Freelancers worked with
-
Projects awarded
0%
Last project
22 Jul 2026
United States
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies