Well I am sure that my code is right. but in my main ().. my cout <<myTree casues an issue and I dont know why . any help would be much needed... I am almost there.

Recommended Answers

All 2 Replies

Well I am sure that my code is right.

It's nice to hear that about the program which you can't compile w/o errors ;)...
Now look at the class BSTree (refactored) interface:

class BSTree
{
public:
        BSTree();
/* Not implemented yet:
    void print_inorder();
    void print_postorder();
    void print_preorder();
*/  
        void insert(Contributor InData);
};

That's all. In other words you can create new BSTree objects then insert Contributor class objects into them. Also you can assign one BSTree object to the other by the default (compiler generated, data member by data member) assignment operator but the only problem is: no data members in this BSTree class at all!

So when you write in the main function:

cout<<myTree<<endl;

you want to get unknown result from an undefined operator <<:

ostream& operator <<(ostream&,const BSTree&);

See Contributor class for example. Look at BSTree declaration again. You promise to implement three member functions to print BSTree. Where are these functions? How binary search tree object can print anything when it's an empty object without data members?

It seems you don't understand your assignment.
Try again then come back...

thanks man . I will go back and un comment. I wrote them but did not implement..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.