I Wrote a program for binary search using cpp. Its working fine except if the Searched Element is not found in the Vector, its returning Garbage value while it should be returning 0.

Here's the code -

```
#include<iostream>
#include<vector>
using namespace std;
int BinarySearch(vector<int> v,int x,int y,int t){
    if(x>y){
        return 0;
    }
    else{
        int m=x+(y-x)/2;
        if(v[m]==t)
        return m;
        else if(v[m]>t){
            BinarySearch(v,x,m-1,t);
        }
        else
        BinarySearch(v,m+1,y,t);
    }
}
main(){
    int n,m=0,no;
    vector <int> v;
    cout<<"Enter the No of Elements u wanna store in the Array : ";
    cin>>n;
    while(n--){
        cout<<"Enter Element "<<++m<<" : ";
        int t;
        cin>>t;
        v.push_back(t);
    }
    cout<<"Enter the no u wanna search for : ";
    cin>>no;
    int Start=0,End=v.size()-1;
    int B=BinarySearch(v,Start,End,no);
    if(B==0){
        cout<<"Element not Found\n";
    }
    else{
        cout<<"The Element is : Element "<<B+1;
    }
}

```