JosepRivaille

P11725: Cerca seqüencial en una taula

Apr 29th, 2015
1,033
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.21 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5.  
  6. bool hi_es(int x, const vector<int>& v) {
  7.     int tam = v.size();
  8.     for (int i = 0; i < tam; ++i) {
  9.         if (v[i] == x) return true;
  10.     }
  11.     return false;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment