Not asking for solution or something
but seems like every Time i wan tto run this code
its stucks ..(something wrong) and i cant find where's the problem
in my program
about the code :
building Treanry Tree
the found function is to check weather the father = son1* son2 *son3;
:
if (pointer->getLeft() == NULL && pointer->getMid() == NULL &&pointer->getMid() == NULL)
Not sure if it's the only problem, but you seem to have a copy-paste holdover in there :)
getRight() is never checked.
Edit: You make a similar copy here
1 2 3 4 5 6 7 8
if (pointer->getRight() != NULL) {
s += found(pointer->getRight());
}
if (pointer->getLeft() != NULL) {
s += found(pointer->getLeft());
}
if (pointer->getRight() != NULL) { // change to getMid()
s += found(pointer->getMid());
Also, a tip:
Every time i want to run this code, its stucks
You should be more specific in explaining the problem.
Is the code crashing, or does the code simply never end (infinite loop)?
Crashing is more likely when you are dereferencing a null pointer; an infinite loop is more likely when you have circular pointers referencing each other. But in your case, it's probably crashing when you try to dereference pointer->getMid() in your 4th if-statement.
yes i already fix what u said agian.
but its says "the system cant find the file specified "
and still have probelm with calling the getleft();
here the comiler point me with the problem