Help please!!

I have a text file that contains integers, I need to read them in and put them into a binary tree and then display the sorted binary tree, using recursion...I am having some real trouble figuring out how to get the integers in the binary tree. Here is what I have so far, if anyone could help, I'd appreciate it. I am pretty confused and so far, the examples I have seen are all pretty far off from what it is I am trying to do. Here is what I have so far:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#include "stdafx.h"
#include <cmath>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <string>
#include <cctype>
using namespace std;


// struct definition for chained hashing method
struct treeNode
{
	int number;
	treeNode *pointerLeft;
	treeNode *pointerRight;
};

// function prototypes
void WelcomeMessage ();
bool OpenAndValidateInputFile (string& fileName, ifstream& textIn);
void ReadNumbersFromFile (treeNode*& treeTopPtr, ifstream& textIn);
void AddToList (treeNode* tmp, treeNode*& treeTopPtr);

int main ()
{
	string fileName;
	ifstream textIn;
	treeNode* treeTopPtr = NULL;

	WelcomeMessage ();

	if (!OpenAndValidateInputFile (fileName, textIn))
	{
		cout << "keep going" << endl;
		system ("PAUSE");
		return 0;
	}
	else
	{
		system ("PAUSE");
		return 0;
	}
}

void WelcomeMessage ()
{
	cout << setw (60) << "Individual Programming Project Implementing" << endl;
	cout << setw (55) << "a Binary Search Tree and Recursion" << endl << endl;

	return;
}

bool OpenAndValidateInputFile (string& fileName, ifstream& textIn)
{
	do
	{
		// ask user for file name
		cout << "Please enter file name (or E to exit): ";
		cin >> fileName;

		if (fileName != "e" && fileName != "E")
		{
			textIn.open (fileName);

			if (!textIn)
			{
				cout << "Error! The file you have entered does not exist! Please try again." << endl << endl;
			}
		}
	}
	while (!textIn && fileName != "e" && fileName != "E");

	if (fileName == "e" || fileName == "E")
	{
		return true;
	}
	else
	{
		return false;
	}
}// end OpenAndValidateInputFile

void ReadNumbersFromFile (treeNode*& treeTopPtr, ifstream& textIn)
{
	// while file is still readable, and peek does not find end-of-file
	while (textIn.good () && textIn.peek () != EOF)
	{
		treeNode* tmp = new treeNode ();

		textIn >> tmp->number;

		AddToList (tmp, treeTopPtr);
	}
		
	//close file
	textIn.close ();
	cin.clear ();
	
	return;
}

void AddToList (treeNode* tmp, treeNode*& treeTopPtr) 
{
	WHAT DO I DO??
}
Topic archived. No new replies allowed.