#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<stdlib.h>#include<math.h>#include<time.h>#include<Windows.h>intmain(){printf("please input select number:");int select;scanf("%d",&select);int array[]={1,5,6,7,8};int left =0;int right =sizeof array /sizeof array[0];int flag =-1;int index =0;while(right >= left){int mid =(right + left)/2;if(select > array[mid]){
left = mid +1;}elseif(select < array[mid]){
right = mid -1;}else{
flag =0;
index = mid;break;}}if(flag ==0){printf("the number index is %d", index);}else{printf("can not find return ;%d",flag);}system("pause");return0;}