Hello, againg, thanks for the help in my other topic, but now, i need again xD.
in this program what i'm doing is to search for a number when the vector is in order, and count how many times that number appears, the problem is that count how many times the number does not appear, but when its appear the program stays in an "standby mode" and the cursor does not move.
int buscarNumOrdenado (int x [MAX]) //MAX is the define
{
int num,d, LimiteInferior, LimiteSuperior,mitad;
d=0;
LimiteInferior = 0;
LimiteSuperior = MAX-1;
cout<<"Favor de escribir el numero que desea buscar ->";
cin>>num;
while(LimiteInferior <= LimiteSuperior){
mitad = (LimiteSuperior + LimiteInferior)/2;
if (num == x[mitad]){
d++;
}
elseif(num >x[mitad])
LimiteInferior = mitad +1;
else
LimiteSuperior = mitad-1;
}
cout<<"El numero "<<num<<" se encontro "<<d<<" veces";
system ("PAUSE");