I am a beginner in c++ and now i reached in array processing binary search. my program is being compiled but it is not showing any result. Please help me out.
#include<iostream.h>
#include<conio.h>
const
int n=10;
void main(){
int a[n] , l , initial, final, mid,data;
for(l=0; l<n; l++)
cin >> a[l] ;
cout << "Enter the data to be searched.";
cin >> data;
initial=0;
final=n-1;
mid=(initial + final) /2 ;
while((initial<=final) && (a[mid] != data ))
{
if(data < a[mid])
final = mid - 1;
else
initial = mid + 1;
}
if(data == a[mid])
cout << "Data present in the list.";
else
cout << "Data is not in the list.";
getch();
}