I wrote a simple code to insert 2,4,8,16,32,3,9,27,5,6,7 into a vector object.
After insert these numbers, I check with std::binary\_search for 8, but weirdly it returns 0.

Here is the code. I do not know why. Could someone help me?
Thanks a lot!

```
#include <iostream>
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

void printVector(vector<int>const & p) {
    for (int i = 0; i < p.size(); i++) 
        cout << p[i] << ' ';
    cout << endl;
}       

int main() {
    const int max = 100;
    int num;
    vector<int> base;

    for (int i = 2; i <= 7; i++) {
        int expo = log(max) / log(i);
        num = 1;
        for (int iexp = 1; iexp < expo; iexp++) {
            num *= i;
            if (!binary_search(base.begin(), base.end(), num)) { // If the number is not in the vector
                base.push_back(num);    // Insert the number 
                printVector(base);      // Reprint the vector
                cout << endl;
            }       
        }       
    }       
    cout << binary_search(base.begin(), base.end(), 8) << endl;
    printVector(base);

    return 0;
}  

```