... struct LittleNote { StringTree * tree; int position; LittleNote(void) { } LittleNote(StringTree * t, int pos): tree(t), position(pos) { } }; LittleNote stack[100]; int numinstack = 0; void push(LittleNote n) { stack[numinstack] = n; numinstack += 1; } LittleNote pop(void) { numinstack -= 1; return stack[numinstack]; } void prepare(StringTree *t) { numinstack = 0; push(LittleNote(t, 1)); } string getnext(void) { while (numinstack>0) { LittleNote note = pop(); StringTree * t = note.tree; switch (note.position) { case 1: { if (t!=NULL) { push(LittleNote(t, 2)); push(LittleNote(t->left, 1)); } break; } case 2: { push(LittleNote(t->right, 1)); return t->data; } } } return "**end**"; } void print(StringTree *t) { prepare(t); while (1) { string s = getnext(); if (s=="**end**") break; cout << s << "\n"; } } ...