const int MAX_ITEMS = 5;
int main()
{
int item;
Stack < int, MAX_ITEMS > intStack;
intStack.makeEmpty();
// Show that the stack is isEmptycout << "The contents of the cleared stack are:
";
while (! intStack.isEmpty())
{
intStack.pop(item);
cout << item << " --> ";
}
cout << "NULL\n";
cout << "Enter integers to be pushed onto the stack: \n";
while (true)
{
cin >> item;
intStack.push(item);
if (intStack.isFull())
break;
}
cout << "The stack values are: ";
while (true)
{
intStack.pop(item);
cout << item << " --> ";
if (intStack.isEmpty())
break;
}
cout << "NULL\n";
return 0;
}