Advertisement
Guest User

testTree.cpp

a guest
Apr 30th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include <iostream>
  2. #include "Node.h"
  3. #include "Tree.h"
  4.  
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     // Now testing Default CTOR
  11.     Tree *T;
  12.     T= new Tree;
  13.  
  14.     // Now testing IsEmpty
  15.     if (T->IsEmpty())
  16.         cout<<"The root has no children"<<endl;
  17.     else
  18.         cout<<"The root has children"<<endl;
  19.  
  20.     //now testing DTOR
  21.     delete T;
  22.  
  23.     // Now testing CTOR when root info is known
  24.     T= new Tree("Is it and Animal?", "computer", "dog");
  25.  
  26.     // Now testing GetRoot
  27.     Tree *right;
  28.     right= T->RChild();
  29.     cout<<"The root of this child is: "<< right->GetRoot()<<endl;
  30.  
  31.  
  32.  
  33.  
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement