> 15 int count = 1;
> 54 int count= 0;
Well your insert is broken for starters, because your messy global variable has nothing to do with the local variable of the same name.
Further, because insert is recursive, you get a FRESH 'count = 0' on each invocation, so your
if (count % 2 == 0)
would seem to just create a list, rather than a tree.
Also note that using the same names for function params and local variables as global names isn't recommended. In general non-const global variables aren't a good idea.
At least they didn't declare another local variable with the same name, nor mis-declare main as returning void.
> cout << "\n\t\a\a1----INSERT A NODE IN A BINARY TREE.\a\a";
WTF are all these \a's for?
\a being "make a beep" is going to be a howling banshee for anyone who has sound enabled in their terminal.
Seesh!
> i need this code in non recursive because i need something in non recursive thank you!!
Because your google-fu only turned up recursive implementations, which you've just palmed off on us as your own work.
You're too lazy to help.
@salem c
first of all you blamed me that i copied this command from google and its not. Its from the proffesor of my subject in the unversity and he wanted me to change this command from recursive to non-recursive and I believe that you fail of doing it and started bringing excuses you piece of shit.
Much of the so called C++ code taught (and still available via the Internet) is just previous C code with small changes (printf to cout etc) to make it look like C++. C++ taught as 'C with bits added on' - rather than a language in it's own right.