0
5
true
false
Question 2
template
void stackType
{
if(!isFullStack())
{
list[stackTop] = newItem;
stackTop++;
}
else
cerr<<"Cannot add to a full stack."<
}
top
pop
push
initializeStack
Question 3
Stack s;
s.push(3);
s.push(7);
x = s.pop();
s.push(5);
y = s.pop();
z = s.pop();
0
3
5
7
0
3
5
7
Applied Math
World History
Chemistry
English
To empty the stack
Return the number of items in the stack
Return true if the stack is empty and false otherwise
Return true if the stack is nonempty and false otherwise
top
pop
push
return
17
23
27
35
x v * y w - +
- x y + v w *
x * y + v * w -
x y - v w + *
Question 10
#include
#include "myStack.h"
using namespace std;
int main()
{
stackType
stackType
intStack.push(18);
intStack.push(21);
intStack.push(25);
tempStack = intStack;
while(!tempStack.isEmptyStack())
{
cout<
tempStack.pop();
}
cout<
cout<
return 0;
}
18 21 25
21 18 25
25 21 18
25 18 21
