CONTENIDO DE LA LECCIÓN 18
CONTENIDO DE LA LECCIÓN 18
CONTENIDO DE LA LECCIÓN 18
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
MIGUEL Á. TOLEDO MARTÍNEZ<br />
/* El siguiente programa: BINARIO.CPP, utiliza una búsqueda binaria para localizar<br />
valores en el arreglo llamado contador, el cual contiene los valores de 1 a<br />
100. La función busquedaBinaria imprime mensajes que describen el proceso.<br />
*/<br />
#include //Para cout y cin<br />
int busquedaBinaria(int arreglo[], int valor, int tamano)<br />
{<br />
int encontrado = 0;<br />
int alto = tamano, bajo = 0, enmedio;<br />
void main(void)<br />
{<br />
enmedio = (alto + bajo) / 2;<br />
cout