程序结果有问题,哪位帮我看下???
#include "stdio.h"void input(int a[10]);
void sort(int a[10]);
void find(int a[10]);
main()
{
int a[10];
input(a);
sort(a);
find(a);
getch();
}
void input(int a[10])
{
int *p;
printf("Enter ten number:\n");
for (p = a; p <= a+9; p++)
{
scanf("%d", p);
}
}
void sort(int a[10])
{
int i, j,temp,*p;
for (i = 0; i < 9; i++)
{
for (p = a,j = 0; j <= 9-i; j++)
{
if (*(p+j) > *(p+j+1))
{
temp = *(p+j);
*(p+j) = *(p+j+1);
*(p+j+1) = temp;
}
}
}
for (p = a; p <= a+9; p++)
{
printf("%5d", *p);
}
printf("\n");
}
void find(int a[10])
{
int *p, *q, min, max, mid, num;
min = 0;
max = 9;
p = #
q = a;
printf("Enter you want to find number:\n");
scanf("%d", p);
while (min <= max)
{
mid = (min + max)/2;
if (*p == *(q+mid))
{
printf("Find!\n");
break;
}
else if (*p > *(p+mid))
{
min = mid + 1;
}
else
{
max = mid - 1;
}
}
if (min > max)
{
printf("No find!\n");
}
}