#include "bool.h"
#include "stack.h"
#include <iostream.h>
#include <iomanip.h>

/**************************************************************************
This driver outputs the following:

Size of stack1 is 100
Size of stack2 is 5
stack1 is empty
Error: stack is empty


  0  1  2  3  4
stack2 is full
Error: stack is full
Number of items on stack2: 5
Value at top of stack2 is 4
Number of items on stack2: 5
4
3
2
1
0
stack2 is empty
Error: stack is empty
  1  2  3
  1  2
  1
**********************************************************************/

void main(void)
{
	int i, value, count, size;

	Stack stack1;     // create stack with default size of MAX_SIZE
	Stack stack2(5);  // create stack with size 5

		// print out size of stack1
	cout << "Size of stack1 is " << stack1.getSize() << endl;

		// print out size of stack2
	cout << "Size of stack2 is " << stack2.getSize() << endl;

		// show that stack1 is empty
	if (stack1.isEmpty())
		cout << "stack1 is empty" << endl;
	else
		cout << "stack1 is NOT empty" << endl;

		// pop item off of empty stack
	stack1.popItem();

	  // display empty stack
	stack1.display();

	//******** do more tests below ***********

	stack1.display();
	stack1.pushItem(1);

	size = stack2.getSize();
	for (i = 0; i < size; i++)
		stack2.pushItem(i);

	stack2.display();

	if (stack2.isFull())
		cout << "stack2 is full" << endl;
	else
		cout << "stack2 is NOT full" << endl;

	stack2.pushItem(9);

	if (!stack2.isEmpty())
	{
		cout << "Number of items on stack2: " << stack2.getCount() << endl;
		value = stack2.peekAtTop();
		cout << "Value at top of stack2 is " << value << endl;
		cout << "Number of items on stack2: " << stack2.getCount() << endl;
	}

	count = stack2.getCount();
	for (i = 0; i < count; i++)
	{
		value = stack2.popItem();
		cout << value << " " << endl;
	}

	if (stack2.isEmpty())
		cout << "stack2 is empty" << endl;
	else
		cout << "stack2 is NOT empty" << endl;

	stack2.popItem();

	stack1.pushItem(2);
	stack1.pushItem(3);
	stack1.display();
	stack1.popItem();
	stack1.display();
	stack1.popItem();
	stack1.display();
	stack1.popItem();
	stack1.display();
}