0

I'm working on an assignment and I need to swap the values from the left side of the tree to the right side and vise versa. I'm having no luck on it so far.

Here is the header file with the important areas

```
template<class elemType>
struct nodeType
{
elemType info;
nodeType<elemType> *llink;
nodeType<elemType> *rlink;
};
template<class elemType>
void binaryTreeType<elemType>::swapSubtreeNodes(nodeType<elemType>* p)
{
if (p==NULL)
{
return;
}
else
{
struct nodeType<elemType> *temp;
// do the subtrees
swapSubtreeNodes(node->left);
swapSubtreeNodes(node->right);
// swap the pointers in this node
temp = node->left;
node->left = node->right;
node->right = temp;
}
}
```

And here is my main menu

```
int main()
{
binaryTreeSearch<int> tree;
int num;
cout << "My Binary Tree Swap Function Program!"<<endl;
cout << endl;
cout << "Insert your numbers (Press Enter after each number)."<<endl;
cout << " To finish enter -999"<<endl;
tree.insert(0);
cin>>num;
while(num != -999)
{
tree.insert(num);
cin>>num;
}
cout << "Here is your unswapped Binary Tree."<<endl;
tree.printTree();
cout <<endl;
cout <<endl;
cout << "Here is your swapped Binary Tree."<<endl;
[B]tree.swapSubtreeNodes();[/B] <----- This is where I'm stuck
tree.printTree();
cout << endl;
```

What am I not seeing here, other than the fact when I call the function I have no arguments in it.