This is not how "iostream.h" should be included. You need to use
#include <iostream>
. Yes, this is how std library headers are designed.
Now,
there is no an error in this line:
bool search(tree_node * ,int);
Generally, your problem is reporting the problem not with the code you were trying to compile. You should not have put this part in the CPP file with the entry-point ("main"), it belongs to the include file and just makes no sense, and then the implementation would be in a separate CPP file you feed to the compilation. If you want to have it in the same file (because other files are not using this class and structure), you should better implement all functions inside the class definition. But if you do it separately, this definition
bool search(tree_node* root,int data) { }
would
not define the class function
search
. To write such definition, you should write it as
bool bst::search(tree_node* root,int data) { }
Conclusion: you need to learn few very basic things: how C/C++ separate compilation works, as well as C++ class syntax for
declaration of classes and
definitions of their members.
Good luck,
—SA