Skip to content
Snippets Groups Projects
0_recherche3b.cpp 330 B
Newer Older
#include <iostream>
#include <vector>
using namespace std;

int recherche(int x, vector<int> t) {
    int indice = -1;
    for(int i=0; i<t.size(); i=i+1) {
        if (t[i]==x) {
            indice = i;
        }
    }
    return indice;
}


int main() {
    vector<int> tab = {3,5,4,5};
    cout << recherche(5, tab) << endl;
}