#include<stdio.h>
int main()
{
int a[5];
printf("please input 5 ascending order:");
for(int i=0;i<5;i++)
{
scanf("%d",&a[i]);
}
int length=sizeof(a)/sizeof(a[0]);
printf("please input your want to find number:");
int x;
scanf("%d",&x);
int low=0;
int high=length;
int mid=(low+high)/2;
while(low!=high){
if(a[mid]==x){
printf("你要找的数在数组的%d位",mid+1);
return 0;
}
else if(a[mid]>x){
high=mid;
mid=(low+high)/2;
}
else if(a[mid]<x){
low=mid;
mid=(low+high)/2;
}
}
printf("查无此树");
}