Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include myStack.h using namespace std; int main() { stackType stack1(50); stackType stack2(50); stack1.initializeStack(); stack1.push(23); stack1.push(45); stack1.push(38); stack2 = stack1; if (stack1 == stack2) cout

#include

#include "myStack.h"

using namespace std;

int main()

{

stackType stack1(50);

stackType stack2(50);

stack1.initializeStack();

stack1.push(23);

stack1.push(45);

stack1.push(38);

stack2 = stack1;

if (stack1 == stack2)

cout

else

cout

stack2.pop();

stack2.push(32);

cout

if (stack1 == stack2)

cout

else

cout

stack2.push(11);

cout

if (stack1 == stack2)

cout

else

cout

return 0;

}

Modify the stack implementation such that it uses a vectors as the container instead of an array.

Overload the pure virtual function push such that it takes a vector as an argument which pushes multiple values onto the stack.

Throw exceptions when:

An attempt is made to pop from an empty stack (display message)

An attempt is made to push onto a full stack (display message)

top() is called on an empty stack (display message).

A negative or zero value for stack size is passed to the constructor (In this case, when handling the error, automatically recall the constructor with a value of 100).

Using the STL queue container, add multiple stackType classes to a queue. Demonstrate an ability to use STL queue methods such as front() and pop().

chpater 18

image text in transcribed

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

Database Reliability Engineering Designing And Operating Resilient Database Systems

Authors: Laine Campbell, Charity Majors

1st Edition

978-1491925942

More Books

Students also viewed these Databases questions

Question

Whats involved in listening?

Answered: 1 week ago