I'm trying to get my binary tree to print out 10 things per line. I'm having issues though, as when the traversing reaches a leaf, on moving to the next printable node my counter is reset to one more than that node's parent, which isn't what I want. I'm not sure how to correct this?

Here's the functions I'm using
Code:
void BinarySortTree::print_preorder()
{
	int n = 0;
	cout << "Preorder: \n";
    preorder(Root, n);
	cout << "\n\n";
}//print_preorder
Code:
void BinarySortTree::preorder(tree_node* p, int numprint) {
	if(p != NULL) {
		numprint++;
		cout << numprint;
        cout<< p->data<<" ";
		preorder(p->left, numprint);
		preorder(p->right, numprint);
    }//if
	else return;
}//preorder
I've moved numprint around a few places, but am not getting the result I wanted.

I initially planned on just doing preorder(p->right/left, numprint++) and the first part of the print_preorder having an if statement saying if (numprint % 10 == 0) cout << endl;

Seemed simple enough, but doesn't work I haven't used recursion a whole lot, can you help?