What's wrong with this code because I'm getting errors but everything looks fine though.
Cross213 -5 Posting Whiz in Training
Recommended Answers
Jump to PostAnd what are your errors?
I would rather see the code posted here instead of download your files...
Jump to PostIf I remember correctly about pointer, line 14 in your BinaryTree
void BinaryTree::insert(int& data)
Are you expecting a pointer for it (with the & symbol), or just a plain integer value? Because you are calling it as
b.insert(60);
I don't know your node structure …
Jump to PostWhen you use "&" in your function declaration, it expects you to pass by reference. As a result, the argument passed in should be variable.
int x=60; b.insert(x);
But I do not believe that the insert() function should take an integer argument that way. Because if the …
Jump to PostSee the difference between the two:
//in .h void inorder(nodeType *p) const; void preorder(nodeType *p) const; void postorder(nodeType *p) const;
//in main b.inorder(); b.preorder(); b.postorder();
All 13 Replies
Taywin 312 Posting Virtuoso
Cross213 -5 Posting Whiz in Training
Cross213 -5 Posting Whiz in Training
Cross213 -5 Posting Whiz in Training
Taywin 312 Posting Virtuoso
Cross213 -5 Posting Whiz in Training
Cross213 -5 Posting Whiz in Training
Taywin 312 Posting Virtuoso
Cross213 -5 Posting Whiz in Training
Taywin 312 Posting Virtuoso
Cross213 -5 Posting Whiz in Training
mrnutty 761 Senior Poster
Cross213 -5 Posting Whiz in Training
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.