This is my tree(without the underscores):
I'm required to print it in this format.
Currently I have this code:
It works fine enough but it prints zeros for the leaf nodes. I've tried putting an if condition if(bt->getData() != 0) before the cout and it works but the 4 moves up to the 5. Any ideas on how to correct this?