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

print

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

print

peek

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!