Code:

#include<iostream.h>
#include<conio.h>
int binarysearch(int[], int, int);
void main(void)
{
clrscr();
int a[10]={6,4,89,23,45,65,88,22,11,56};
int loc, item, n=10;
cout<<"Enter Item for Search: ";
cin>>item;
loc=binarysearch(a, item, n);
if(loc == -1)
cout<<"Not Found\n";
else
cout<<"Found At Location: "<<loc;
getch();
}
int binarysearch(int a[], int item, int n)
{
int mid, end, beg;
beg=0;
end=n-1;
while(beg <= end)
{
mid=int((beg+end)/2);
if(item == a[mid])
return mid;
if(item < a[mid])
end=mid-1;
else
beg=mid+1;
}
return -1;
}

what's wrong with this? ;\ please let me know

thanks