Now, intStack is full.
9 September 9th September 9th September 9th September 9 9
9 8 7 6 5 4 3 2 1 0
Now, intStack is empty.
There are five elements in stringStack.
Now, there are no elements in stringStack
My question code below
# include
using namespace std;
Template
Private:
T array [SIZE];//array, used to hold the stack elements
int top;//stack location (array subscript)
Public:
The Stack ();//the constructor to initialize the stack
Void push (const T & amp; );//element into the stack
T pop ();//top element out stack
Void the clear ();//will stack empty
Const T & amp; Top () const;//access stack element
Bool empty () const;//test whether the stack is empty
Bool full () const;//test whether stack full
Int size ();//returns the current number of elements in the stack
};
Template
Stack
Top=0;
}
Template
Void Stack
{
Top=top + 1;
Array [top]=a;
}
Template
T Stack
{
T T=array (top),
Top=top - 1;
Cout
}
Template
Void Stack
{
The delete [] array.
}
Template
Const T & amp; Stack
{
T T=array (top),
return t;
}
Template
Bool Stack
{
If (top==0) return true;
else return false;
}
Template
Bool Stack
{
If (top==SIZE) return true;
else return false;
}
Template
Int Stack
{
Return the top;
}
Int main ()
{
Stack
IntStack. Push (I);
Cout< if (intStack. Full ()); & lt;" Now, intStack is full. "& lt;
Cout
Cout
Cout<& lt;" Now, intStack is empty. "& lt;
Stack
StringStack. Push (" Two ");
StringStack. Push (" Three ");
StringStack. Push (" Four ");
StringStack. Push (" Five ");
Cout<& lt;" There are "& lt;
If (stringStack. Empty ())
Cout<& lt;" Now, there are no elements in stringStack "& lt;
return 0;
}