home | login | register | DMCA | contacts | help | donate |      

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
А Б В Г Д Е Ж З И Й К Л М Н О П Р С Т У Ф Х Ц Ч Ш Щ Э Ю Я


my bookshelf | genres | recommend | rating of books | rating of authors | reviews | new | форум | collections | читалки | авторам | add
fantasy
space fantasy
fantasy is horrors
heroic
prose
  military
  child
  russian
detective
  action
  child
  ironical
  historical
  political
western
adventure
adventure (child)
child's stories
love
religion
antique
Scientific literature
biography
business
home pets
animals
art
history
computers
linguistics
mathematics
religion
home_garden
sport
technique
publicism
philosophy
chemistry
close

Loading...


Example

int main() {

int A[] = { 1, 2, 3, 3, 3, 5, 8 };

 const int N = sizeof(A) / sizeof(int);

 for (int i = 1; i <= 10; ++i) {

  cout << "Searching for " << i << ": " << (binary_search(A, A + N, i) ? "present" : "not present") << endl;

 }

}

The output is:

Searching for 1: present

Searching for 2: present

Searching for 3: present

Searching for 4: not present

Searching for 5: present

Searching for 6: not present

Searching for 7: not present

Searching for 8: present

Searching for 9: not present

Searching for 10: not present


Complexity | Standard Template Library Programmer`s Guide | Notes







Loading...