... int printlevel(StringTree * t, int level) { int numprinted=0; if (t==NULL) return numprinted; numprinted += printlevel(t->left, level-1); if (level==0) { cout << t->data; numprinted+=1; } else spaces(t->data.length()); numprinted += printlevel(t->right, level-1); return numprinted; } void print(StringTree * t) { for (int i=0; true; i+=1) { int numprinted = printlevel(t, i); cout << "\n\n"; if (numprinted==0) break; } } ... ... else if (command=="p") { print(tree); cout << "\n"; } ...