Question
Data Structure Please write in C++ 1. Turn your linked list into a Stack. At a minimum your Stack should have the functions push(), pop(),
Data Structure
Please write in C++
1. Turn your linked list into a Stack. At a minimum your Stack should have the functions push(), pop(), and peek(), empty(), and print(). Be sure to have a Stack.h, Stack.cpp and main.cpp file in your submission. This time write your program so that it asks the user for input and calls the appropriate functions. When pop is called the number that is popped should be displayed. Commands will be formatted as follows on the command line
push num
pop
empty
peek
2. Turn your linked list into a Queue. At a minimum your Queue should have the functions push(), pop(), and peek(), empty(), and print(). Be sure to have a Stack.h, Stack.cpp and main.cpp file in your submission. This time write your program so that it asks the user for input and calls the appropriate functions. When pop is called the number that is popped should be displayed. Commands will be formatted as follows on the command line
push num
pop
empty
peek
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started