I have created a binary tree, and as part of the assignment we are supposed to write the tree nodes to a file, I thought modifying the inorder display function would do the trick, but it doesn't. Can anyone help with this. Here's what I have for the function right now:
template <typename T>
void BSearch <T>::write (Node <T> *& root)
{
New.open("New.txt"); //New is a ofstream object private member of the BinaryTree header
if ( root!=0)
{
inorder (root -> left);
New << root -> data;
inorder (root -> right);
}
}