大家帮忙看下以下的这段代码有什么问题!!!我编译了下 没语法错误 但执行得不到要的结果!!
用折半法查找读入数组中是否有十这个数 无输出代表没找到!!!
#include"stdio.h"
#define N 10
main()
{
int i, x, low, high, mid;
int v[N];
x = 10;
printf("please input the numbers.\n");
for(i=0; i<=N; i++)
scanf("%d", v);
high = N - 1;
low = 0;
while(high >= low)
{
mid = (high + low) / 2;
if(x > v[mid])
low = mid + 1;
else if(x < v[mid])
high = mid - 1;
else
printf("%d", mid);
}
}