Question: Q- Given the abstract data type (ADT) for static stack template in Stack.h below template class Stack { private: T *stackArray; int stackSize; int top;

Q- Given the abstract data type (ADT) for static stack template in Stack.h below

template

class Stack

{

private:

T *stackArray;

int stackSize;

int top;

public:

Stack(int);

Stack(const Stack&);

~Stack();

void push(T);

void pop(T &);

bool isFull();

bool isEmpty();

};

Construct a simple C++ program that creates a stack of strings so that the sentences can be inserted and retrieve from the stack. The program should prompt the user for input and then print out the retrieved sentences line by line. You may want to use a loop for input and output so that your program would not be too long. The input sentences are as follows:

  • Nothing is impossible
  • If you believe in yourself
  • Never give-up
  • Keep moving forward

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!