Binary search tree issues

kjaswdqeeas
Last edited on
thanks for not helping. I solved all problems.
Last edited on
Could you exactly tell what problems you have ? generally looking for problems in a code is not a good idea.

In file included from driver.cpp:1:
tree.h: In member function `void tree<T>::leafCount() const':
tree.h:51: error: `val' undeclared (first use this function)
tree.h:51: error: (Each undeclared identifier is reported only once for each function it appears in.)

tree.h: In member function `int tree<T>::calculateHeightHelper(treeNode<T>*)':

tree.h:189: error: `leftPtr' undeclared (first use this function)
tree.h:190: error: `rightPtr' undeclared (first use this function)
tree.h: In member function `void tree<T>::search()':
tree.h:217: error: `data' undeclared (first use this function)

tree.h: In member function `void tree<T>::search() [with T = int]':
driver.cpp:78:   instantiated from here
tree.h:217: error: return-statement with a value, in function returning 'void'
tree.h: In member function `int tree<T>::calculateHeight() [with T = int]':
driver.cpp:83:   instantiated from here
tree.h:175: error: no matching function for call to `tree<int>::calculateHeight(treeNode<int>*&)'
tree.h:173: note: candidates are: int tree<T>::calculateHeight() [with T = int]


Are the errors i get when i run it. Which is why i mentioned that i think my problems lie within the function headers. Sorry for editing what i already posted i copied the code from the wrong file.
Last edited on
Can anyone offer any solution to my problems
Don't be impatient. People here are quite helpful and quick.


line 51
val is not declared.

189, 190 - variables are not declared.
217 - function has void return type, it should not return a value.


I wonder, if you are working with templates and not able to fix these simple issues ?
thanks for not helping. I solved all problems.


we are not paid here to fix your issues... try to help yourself rather than being arrogant.
Topic archived. No new replies allowed.