Advertisement
sellmmaahh

TP-tut5-zad5

Sep 3rd, 2015
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7.  
  8. int main () {
  9.     int niz[10]={2,3,66,55,4,2,7,8,12,78};
  10.     sort(niz,niz+10);
  11.     if (binary_search(niz,niz+10,55)) {
  12.             cout<<"Element 55 se nalazi na poziciji: "<<lower_bound(niz,niz+10,55)-niz;
  13.     }
  14.     else cout<<"Element 55 se ne nalazi u nizu.";
  15.     return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement