im trying to store preorder tree transversal into a stack though am getting a wide array of errors: to many arguments in void print_order, to many arguments in void preorder, and push has not been declared. any help please!
void print_inorder(BST *& p, stack <int> *& s);
void printOutText(BST *& p)
{
ofstream myfile;
myfile.open ("example.txt");
stack <int> s;
preorder(p, s);
myfile.close();
}
void preorder(BST *& p, stack <int> *& s)
{
if (p != NULL)
{
s.push(p->data);
preorder(p->left); // print left subtree
preorder(p->right); // print right subtree
}