Skip to content

cpbook-code/ch1/Ex_1.3.4.1 /task06.cpp #114

@ronijaat

Description

@ronijaat

#include <bits/stdc++.h> // C++ code for task 6
using namespace std;
int main() {
int n = 5, L[] = {10, 7, 5, 20, 8}, v = 7;
sort(L, L+n);
printf("%d\n", binary_search(L, L+n, v)); // should be index 1

** it returns boolean, not index**

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions