home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 13 / CDA13.ISO / cdactual / demobin / share / program / Pascal / BFTGPH.ZIP / TESTTREE.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1991-09-09  |  1.1 KB  |  48 lines

  1. Program testtree;
  2.  
  3. uses tree,crt;
  4.  
  5. var root : t;
  6.     n,m: TreePointer;
  7.     x: integer;
  8.  
  9. Begin
  10.    x:=999;
  11.    root:=NewTree(x);
  12.    x:=123;
  13.    AddTreeNode(root^,x);
  14.    x:=456;
  15.    AddtreeNode(root^,x);
  16.    x:=567;
  17.    AddtreeNode(root^,x);
  18.    x:=765;
  19.    addtreenode(Firstchild(root^),x);
  20.    x:=678;
  21.    addtreenode(Firstchild(root^),x);
  22.    x:=159;
  23.    addtreenode(Firstchild(Firstchild(root^)),x);
  24.    x:=259;
  25.    addtreenode(Firstchild(Firstchild(root^)),x);
  26.    x:=359;
  27.    addtreenode(Firstchild(Firstchild(root^)),x);
  28.    x:=169;
  29.    addtreenode(Firstchild(Firstchild(root^))^.brother,x);
  30.    x:=269;
  31.    addtreenode(Firstchild(Firstchild(root^))^.brother,x);
  32.    x:=369;
  33.    addtreenode(Firstchild(Firstchild(root^))^.brother,x);
  34.    x:=789;
  35.    addtreenode(Firstchild(root^),x);
  36.    x:=888;
  37.    addtreenode(firstchild(root^)^.brother,x);
  38.    x:=777;
  39.    addtreenode(firstchild(root^)^.brother,x);
  40.    x:=555;
  41.    addtreenode(firstchild(root^)^.brother^.brother,x);
  42.    x:=444;
  43.    addtreenode(firstchild(root^)^.brother^.brother,x);
  44.    clrscr;
  45.    writeln('Tree:');
  46.    printtree(root);
  47. end.
  48.