SHARE
TWEET

Untitled

a guest Nov 19th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "CNodeStatic.h"
  2. #include "CTreeStatic.h"
  3. #include "CNodeDynamic.h"
  4. #include "CTreeDynamic.h"
  5.  
  6. int main()
  7. {
  8.     /*CNodeStatic c_root;
  9.     c_root.vAddNewChild();
  10.     c_root.vAddNewChild();
  11.     c_root.pcGetChild(0)->vSetValue(1);
  12.     c_root.pcGetChild(1)->vSetValue(2);
  13.     c_root.pcGetChild(0)->vAddNewChild();
  14.     c_root.pcGetChild(0)->vAddNewChild();
  15.     c_root.pcGetChild(0)->pcGetChild(0)->vSetValue(11);
  16.     c_root.pcGetChild(0)->pcGetChild(1)->vSetValue(12);
  17.     c_root.pcGetChild(1)->vAddNewChild();
  18.     c_root.pcGetChild(1)->vAddNewChild();
  19.     c_root.pcGetChild(1)->pcGetChild(0)->vSetValue(21);
  20.     c_root.pcGetChild(1)->pcGetChild(1)->vSetValue(22);
  21.     c_root.vPrintAllBelow();
  22.     cout << endl;
  23.     c_root.pcGetChild(0)->pcGetChild(1)->vPrintUp();
  24.     cout << endl;
  25.     c_root.vPrintUp();
  26.     cout << endl;
  27.     CTreeStatic ctreestatic1;
  28.     ctreestatic1.pcGetRoot()->vAddNewChild();
  29.     ctreestatic1.pcGetRoot()->vAddNewChild();
  30.     ctreestatic1.vPrintTree();
  31.     cout << "####" << endl;
  32.     CTreeStatic ctreestatic2;
  33.     ctreestatic2.pcGetRoot()->vAddNewChild(c_root);
  34.     ctreestatic2.bMoveSubtree(ctreestatic2.pcGetRoot()->pcGetChild(0), ctreestatic1.pcGetRoot()->pcGetChild(0));
  35.     ctreestatic2.vPrintTree();
  36.  
  37.     cout << endl;*/
  38.  
  39.     ///////////////////////////////////////////////////////////////
  40.     /*CNodeDynamic CNodeDynamic;
  41.     CNodeDynamic.vAddNewChild();
  42.     CNodeDynamic.vAddNewChild();
  43.     CNodeDynamic.pcGetChild(0)->vSetValue(1);
  44.     CNodeDynamic.pcGetChild(1)->vSetValue(2);
  45.     CNodeDynamic.pcGetChild(0)->vAddNewChild();
  46.     CNodeDynamic.pcGetChild(0)->vAddNewChild();
  47.     CNodeDynamic.pcGetChild(0)->pcGetChild(0)->vSetValue(11);
  48.     CNodeDynamic.pcGetChild(0)->pcGetChild(1)->vSetValue(12);
  49.     CNodeDynamic.pcGetChild(1)->vAddNewChild();
  50.     CNodeDynamic.pcGetChild(1)->vAddNewChild();
  51.     CNodeDynamic.pcGetChild(1)->pcGetChild(0)->vSetValue(21);
  52.     CNodeDynamic.pcGetChild(1)->pcGetChild(1)->vSetValue(22);
  53.     CNodeDynamic.vPrintAllBelow();*/
  54.  
  55.     //////////////////////////////////////////////////////////
  56.     cout << endl;
  57.     CTreeDynamic ctdFirst;
  58.     ctdFirst.pcGetRoot()->vSetValue(1);
  59.     ctdFirst.pcGetRoot()->vAddNewChild();
  60.     ctdFirst.pcGetRoot()->vAddNewChild();
  61.     ctdFirst.pcGetRoot()->pcGetChild(0)->vSetValue(2);
  62.     ctdFirst.pcGetRoot()->pcGetChild(1)->vSetValue(3);
  63.     ctdFirst.pcGetRoot()->pcGetChild(0)->vAddNewChild();
  64.     ctdFirst.pcGetRoot()->pcGetChild(0)->vAddNewChild();
  65.     ctdFirst.pcGetRoot()->pcGetChild(0)->pcGetChild(0)->vSetValue(21);
  66.     ctdFirst.pcGetRoot()->pcGetChild(0)->pcGetChild(1)->vSetValue(22);
  67.     ctdFirst.pcGetRoot()->pcGetChild(1)->vSetValue(3);
  68.  
  69.     CTreeDynamic ctdSecond;
  70.     ctdSecond.pcGetRoot()->vSetValue(10);
  71.     ctdSecond.pcGetRoot()->vAddNewChild();
  72.     ctdSecond.pcGetRoot()->vAddNewChild();
  73.     ctdSecond.pcGetRoot()->pcGetChild(0)->vSetValue(20);
  74.     ctdSecond.pcGetRoot()->pcGetChild(1)->vSetValue(30);
  75.     ctdSecond.pcGetRoot()->pcGetChild(0)->vAddNewChild();
  76.     ctdSecond.pcGetRoot()->pcGetChild(0)->vAddNewChild();
  77.     ctdSecond.pcGetRoot()->pcGetChild(0)->pcGetChild(0)->vSetValue(200);
  78.     ctdSecond.pcGetRoot()->pcGetChild(0)->pcGetChild(1)->vSetValue(210);
  79.     ctdSecond.pcGetRoot()->pcGetChild(1)->vSetValue(30);
  80.  
  81.     ctdFirst.bMoveSubtree(ctdFirst.pcGetRoot()->pcGetChild(0)->pcGetChild(0), ctdSecond.pcGetRoot()->pcGetChild(0));
  82.     ctdFirst.vPrintTree();
  83.     cout << endl;
  84.  
  85.     CTreeStatic ctsFirst;
  86.     ctsFirst.pcGetRoot()->vSetValue(1);
  87.     ctsFirst.pcGetRoot()->vAddNewChild();
  88.     ctsFirst.pcGetRoot()->vAddNewChild();
  89.     ctsFirst.pcGetRoot()->pcGetChild(0)->vSetValue(2);
  90.     ctsFirst.pcGetRoot()->pcGetChild(1)->vSetValue(3);
  91.     ctsFirst.pcGetRoot()->pcGetChild(0)->vAddNewChild();
  92.     ctsFirst.pcGetRoot()->pcGetChild(0)->vAddNewChild();
  93.     ctsFirst.pcGetRoot()->pcGetChild(0)->pcGetChild(0)->vSetValue(21);
  94.     ctsFirst.pcGetRoot()->pcGetChild(0)->pcGetChild(1)->vSetValue(22);
  95.     ctsFirst.pcGetRoot()->pcGetChild(1)->vSetValue(3);
  96.  
  97.     CTreeStatic ctsSecond;
  98.     ctsSecond.pcGetRoot()->vSetValue(10);
  99.     ctsSecond.pcGetRoot()->vAddNewChild();
  100.     ctsSecond.pcGetRoot()->vAddNewChild();
  101.     ctsSecond.pcGetRoot()->pcGetChild(0)->vSetValue(20);
  102.     ctsSecond.pcGetRoot()->pcGetChild(1)->vSetValue(30);
  103.     ctsSecond.pcGetRoot()->pcGetChild(0)->vAddNewChild();
  104.     ctsSecond.pcGetRoot()->pcGetChild(0)->vAddNewChild();
  105.     ctsSecond.pcGetRoot()->pcGetChild(0)->pcGetChild(0)->vSetValue(200);
  106.     ctsSecond.pcGetRoot()->pcGetChild(0)->pcGetChild(1)->vSetValue(210);
  107.     ctsSecond.pcGetRoot()->pcGetChild(1)->vSetValue(30);
  108.  
  109.     ctsFirst.bMoveSubtree(ctsFirst.pcGetRoot()->pcGetChild(0)->pcGetChild(0), ctsSecond.pcGetRoot()->pcGetChild(0));
  110.     ctsFirst.vPrintTree();
  111.     cout << endl;
  112.     system("pause");
  113. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top