First and Last Occurrence using Binary Search

exit: Ctrl+↩
#include <iostream>
#include <cstdlib>
#include <stdio.h>
#include <assert.h>
using namespace std;
int BinarySearch(int arr[],int n,int key)
{
int low=0 ,high=n ,mid ,found = -1;
while(low <= high)
{
mid = low+ (high-low)/2;
if(arr[mid] == key)
{
found = mid;
high = mid-1; //key paoar por o left e aro khujbo
}
else if( key > arr[mid])
{
low = mid+1;
}
else
{
high = mid-1;
}
}
return found;
}
int main()
{
int arr[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
int found = BinarySearch(arr,9,10);
cout<<found<<endl;
return 0;
}