Originally Posted by
OctavianC
It finishes when I introduce a value that IS in the vector. When I introduce a value that IS NOT, then it does not.
You have a while loop like this:
Code:
while (flag == 0 && inf <= supp) {
...
}
It contains the condition flag == 0 && inf <= supp. When that condition becomes false, then the loop will end.
You have 2 end conditions for your algorithm, number one is that you find the value and number two is that you go through all elements and don't find the value. One of them loops forever, which means that flag == 0 && inf <= supp is always true when that happens.
You need to find out why, Jim advices you to use the debugger to start to understand why, and this is excellent advice.