Need help on basic binary tree programming

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DemonFox
    New Member
    • Oct 2007
    • 15

    #16
    i found the caouse of problem it was the follow
    int the tree.cpp i made the changes:
    tree::tree(PTR t1)
    {
    PTR t;
    t->data=t1->data;
    t->left=t1->left;
    t->right=t1->right;
    }

    and now it is ok
    :P:P:P:P:P
    but the next thing is:
    void tree::preorder_ traversal(PTR t)
    {
    if(t!=NULL)
    {
    printf("%d",t->data);
    preorder_traver sal(t->left);
    preorder_traver sal(t->right);
    }
    }



    How can i take the results of the function into a Edit??????
    in optical interface?

    Comment

    • weaknessforcats
      Recognized Expert Expert
      • Mar 2007
      • 9214

      #17
      Originally posted by DemonFox
      How can i take the results of the function into a Edit??????
      in optical interface?
      I don't think I understand your requirement. Can you provide a little more info.

      Comment

      • DemonFox
        New Member
        • Oct 2007
        • 15

        #18
        I have this
        void tree::preorder_ traversal(PTR t)
        {
        if(t!=NULL)
        {
        printf("%d",t->data);
        preorder_traver sal(t->left);
        preorder_traver sal(t->right);
        }
        }

        i want the results of the traversal
        to be shown on an edit box.
        the final think i want is to (give)insert a node to be presented in icons in a paintbox
        to be shown step by step the traversals. did this help????

        Comment

        • weaknessforcats
          Recognized Expert Expert
          • Mar 2007
          • 9214

          #19
          Are you using Windows?

          If so there is a Tree control in MFC called CTreeCtrl. All the graphical work is done.

          Comment

          • DemonFox
            New Member
            • Oct 2007
            • 15

            #20
            Originally posted by weaknessforcats
            Are you using Windows?

            If so there is a Tree control in MFC called CTreeCtrl. All the graphical work is done.


            Iam using now CodeGear borland c++ 2007 is it working????

            Comment

            • DemonFox
              New Member
              • Oct 2007
              • 15

              #21
              do someone Know about paintbox?????

              Comment

              Working...