ممكن اعرف الخطأهنا
#include <iostream>
using namespace std;
int binarysearch(int array[],int size,int value){
int first=0;
int last=size-1;
int middle;
int position=-1;
bool found= false;
while(!found&&first<=last){
if (array[middle]==value){
position=middle;
found=true;
}
else if(array[middle]>value){
last=middle-1;}
else {first=middle+1;}
}
return position;
}
const int size=5;
int main()
{int arr={10,9,5,4,3};
int c=binarysearch(arr,size,3);
cout<<"the number of value="<<c;
return 0;
}