// File: main1.C // Using the Tree class #include #include #include "item.h" #include "tree.h" main() { Tree *root, *temp1, *temp2, *temp3 ; printf("Building the company tree...\n") ; temp1 = new Tree("Worker Bee #1") ; temp2 = new Tree("Worker Bee #2") ; temp3 = new Tree("Manager #1", temp1, temp2) ; temp1 = new Tree("Manager #2", NULL, new Tree("Worker Bee #3")) ; temp1 = new Tree("VP #1", temp3, temp1) ; temp3 = new Tree("Manager #3", new Tree("Worker Bee #4"), NULL) ; temp2 = new Tree("VP #2", temp3, NULL) ; root = new Tree("President", temp1, temp2) ; printf("\nPreorder Traversal:\n") ; root->Preorder() ; printf("\n") ; printf("\nPostorder Traversal:\n") ; root->Postorder() ; printf("\n") ; printf("\nInorder Traversal:\n") ; root->Inorder() ; printf("\n") ; }