//Applications off arrays //Program for BINARY SEARCH #include #include #include void main() { clrscr(); int series[100],n,pos,x,i; int first, last, middle; cout<<"Enter the size of the list\n"; cin>>n; cout<<"Enter the list\n"; for(i=0;i>series[i]; first=0; pos=-1; last=n-1; cout<<"enter the value to be searched\n"; cin>>x; //search the list while((first<=last)&&(pos==-1)) { middle=(first+last)/2; if(series[middle]==x) first=middle+1; else if (series[middle]-1) cout<<"The position of the element is="<<++pos; else cout<<"Unsuccessful search"; getch(); }