Adding an object to this tree.

Hello all

Disclaimer: this is homework
Justification: it is already been submitted :( / I want to know what I am doing wrong / I am not asking anyone to do my homework. I want to do it still!!

I am in the process of building a general tree.
I am stuck on adding an object through to my tree

The only specification I need to follow is listed in the main class.
There are no other specif actions that I must follow, so please feel free to call me out on any major flaws. If It takes a major rewrite I am open to that as well...

Small tangent() {

At this point my code is little all over the place as so as I am. As most of you can relate to coding for hours and just then unraveling to guessing a checking. I have tried to keep things semi organized but alas coding / troubleshooting unit ll 5 am yesterday and back at it today there might be... I have no idea where I was going to take this...

well at lease excuse me using std::string and char* for the same constructors: I was just trying things...

return to_thread
}


listed below is my code.
https://gist.github.com/pemby/1923e1a04434650f2ba7


If you need to ask me any questions feel free to ask. I would be happy to clarify!

Cheers!

you forgot SkillTree.h


1
2
3
4
void SkillTree::setelement (Skill element)
{
  setelement (element); //infinite recursion
}
Yes I see what you are saying. I am not sure how to handel the set element function however.

in pesudo... I would see it working this way.




1
2
3
4
5
setelement (Skill element)
{
skilltree local_object_ptr = get_cur_tree_object()
local_object_ptr->data = element; 
}



I am not sure how to make the above "idea" work
I think my confusion stems from the below and


1
2
3
4
5
6
7
8
9
10
11
12
13
14
  typedef struct GTREE_NODE
  {

    SkillTree *leftchild_;
    SkillTree *rightchild_;
    Skill data;
    std::string title;
    std::ostream *SkillTree_out;

    GTREE_NODE *first_childptr;
    GTREE_NODE *sibling_listptr;

  } *GTREE_NODE_PTR;


I am not sure how to access and set the data element object of in each instance of the skilltree class.

does that make sense?
Last edited on
Topic archived. No new replies allowed.