Question: My code doesn't seem to work and I cannot understand why. 
When the user enters a number to search for its location it doesn't show anything. If anyone could explain it to me I would greatly appreciate it.

```
        void Array::binarySearch(vector<int> vect)
            {
                int search_val;
                int high = (int)vect.size();
                int low = 0;
                int mid = 0;
                bool found = false;
                cout << "Enter Number to search : ";
                cin>>search_val;
                        while (low <= high && !found) {
                            mid = (high + low)/2;
                            if (search_val > vect[mid]) {
                                low = mid + 1;
                            } else if (search_val < vect[mid]) {
                                high = mid - 1;
                            } else {
                                cout << "Number you entered " << search_val << " was found in position " << mid << endl;
                                found = true;
                            }
                        }

                    if (!found) {
                        cout << " The value isn't found " << endl;
                    }
                }

```

sorted algo:

```
void Array::arrSort(vector<int> vect)
{
    for (unsigned int i = 0; i < vect.size()-1; i++)
    {
        for (unsigned int j = 0; j < vect.size()-i-1; j++)
        {
            if (vect[j] > vect[j+1])
            {
                int x = vect[j+1];
                vect[j+1] = vect[j];
                vect[j] = x;
            }
        }
    }
    cout<<"Sorted output is "<<endl;
    printArr(vect);
}

```

Answer: 
Your `arrSort` function takes its parameter by value, so it receives (and sorts) a *copy* of the original array.

To sort the array you're passing in, take the parameter by reference:

```
void Array::arrSort(vector<int> &vect)

```
As someone has pointed out, you must ensure that you are performing binary search on a sorted array. Perhaps, you should build and test each algorithm separately to ensure correctness before combining them together.

Check out [std::sort](https://en.cppreference.com/w/cpp/algorithm/sort) to get your binary search function working, then work on your sort function––or vice versa.

Also, if you have found the item you are looking for say, `vect[mid] == search_val` you can go ahead and `return` true (or print like you've done) and terminate the algorithm.