//----------------------------------------------------------------------------- #include #include "narytreeclass.cpp" //----------------------------------------------------------------------------- void ExternalPreorder(tree MyTree); //----------------------------------------------------------------------------- int main(void) { tree MyTree; treeiterator MyIterator(MyTree); MyTree.AddRoot(0); MyIterator.GoRoot(); MyIterator.AddOffspring(1,1); MyIterator.AddOffspring(2,2); MyTree.PreorderTaverse(); MyIterator.GoDown(1); MyIterator.AddOffspring(1,3); MyIterator.AddOffspring(2,4); MyTree.PreorderTaverse(); MyIterator.GoDown(2); MyIterator.AddOffspring(1,5); MyIterator.AddOffspring(2,6); MyTree.PreorderTaverse(); MyIterator.GoUp(); MyIterator.GoUp(); MyIterator.GoDown(2); MyIterator.AddOffspring(1,7); MyIterator.AddOffspring(2,8); MyIterator.AddOffspring(3,9); MyTree.PreorderTaverse(); cout << "And now an external traverse" << endl; ExternalPreorder(MyTree); return(0); } //----------------------------------------------------------------------------- void ExternalPreorder(tree MyTree) { cout << "MTH517 students can easily implement this!" << endl; } //-----------------------------------------------------------------------------