Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual Basic 2008 Comprehensive Concepts And Techniques

Authors: Gary B. Shelly, Corinne Hoisington

1st Edition

1423927168, 978-1423927167

More Books

Students also viewed these Databases questions

Question

6. Identify characteristics of whiteness.

Answered: 1 week ago

Question

9. Explain the relationship between identity and communication.

Answered: 1 week ago