#include".h"
#define N 10
main
{
int i,j,number,top,bott,mid,loca,a[N],flag;
char c;
printf("输入15个数\n");
for(i=0;i++;i<15)
scanf("%d",&a[i]);
loca=0;
top=0;
bott=N-1;
if((number<a[0])||(number>a[N-1]))
loca=-1;
while((loca>=0)&&(top<=bott))
{
mid=(bott+top)/2;
if(number==a[mid]
{
loca=mid;
printf("%d位于表中第%个数\n",number,loca+1);
}
else if(nuber<a[mid])
bott=mid-1;
else
top=mid+1;
}
if(loca==0||loca==-1)
printf("%d不在表中。\n",number);
}
#include".h"
#define N 10
main
{
int i,j,number,top,bott,mid,loca,a[N],flag;
char c;
printf("输入15个数\n");
for(i=0;i++;i<15)
scanf("%d",&a[i]);
loca=0;
top=0;
bott=N-1;
if((number<a[0])||(number>a[N-1]))
loca=-1;
while((loca>=0)&&(top<=bott))
{
mid=(bott+top)/2;
if(number==a[mid]
{
loca=mid;
printf("%d位于表中第%个数\n",number,loca+1);
}
else if(nuber<a[mid])
bott=mid-1;
else
top=mid+1;
}
if(loca==0||loca==-1)
printf("%d不在表中。\n",number);
}