// Course:            CS3420
// Exercise:		  Binary Search Tree

// First Name:        Enter your FIRST name here (eg, John)
// Last Name:         Enter your LAST name here (eg, Doe)
// ID Number:         Enter your ID number here (eg, 12-345-678)
// Email address:     Enter your UCR email address here (eg, jdoe@cs.ucr.edu)

// ===============================================================
   
#include <iostream>
#include "BST.h"
using namespace std;

// display the item key
void display(TreeItemType& anItem)
{
	cout << anItem.getKey() << endl;
}

// read from console the tree values
void storeTreeNodes(BinarySearchTree& tree)
{
	int value; // node value	
	cout << "Enter a positive value (negative value to stop): " ;
	cin >> value;
	while (value > -1)
	{
		tree.searchTreeInsert(value);
		
		cout << "Enter a positive value (negative value to stop): " ;
		cin >> value;	
	}
}

int main()
{
	BinarySearchTree aTree;
	
	storeTreeNodes(aTree);
	int low, high;
	
	cout << endl << "-------------------------------------------------" << endl;
	cout << "IN ORDER TRAVERSE: "<< endl;
	aTree.inorderTraverse(display);
	
	return 0;
}