Help with Binary Tree Insertion

I am trying to insert a team object into a binary tree however the insertion just inserts the default values for the tree and not the actual values read in from the file. I think it has to do with pointers but I don't understand those that well and was wondering it it was something obvious that you guys can find. Please let me know if you would like me to include any other parts of my code.

Code that reads in the file and sets the team and then inserts it into the tree.
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
if(inputFile.good())
	{
		cout << "File was opened!" << endl;
		while (inputFile.good())
		{
			getline(inputFile, line);
			team->setTeamName(line);
			getline(inputFile, line);
			team->setNickname(line);
			getline(inputFile, line, ' ');
			wins =::atoi(line.c_str());
			team->setWins(wins);
			getline(inputFile, line, ' ');
			getline(inputFile, line, ' ');
			losses =::atoi(line.c_str());
			team->setLosses(losses);
			getline(inputFile, line);
			getline(inputFile, line);
			team->setConference(line);

			basketballTeams->insert(team);
			
		}

		basketballTeams->walk(basketballTeams->Root());


Code for the insertion into the tree.
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
void BinaryTree::insert(Team *team) {
	int inserted = 0;
	TreeNode *locn = node;
	TreeNode *temp = new TreeNode();
	temp->setTeam(team);
	temp->setLeft(NULL);
	temp->setRight(NULL);
	if(node == NULL) {
		TreeNode* n = new TreeNode();
		n->setTeam(team);
		node = n;
	}
	else
		while(inserted != 1) {
			if (locn->getTeam().getTeamName() > temp->getTeam().getTeamName()) {
				if (locn->getLeft() == NULL) {
					locn->setLeft(temp);
					inserted = 1;
				}
				else 
					locn = locn->getLeft();
			}
			else {
				if(locn->getRight() == NULL) {
					locn->setRight(temp);
					inserted = 1;
				}
				else
					locn = locn->getRight();
			}
		}
	}
Topic archived. No new replies allowed.