mardi 1 janvier 2019

How do i know, if i found the number that i searched in a STL list.

int main(){
list<int> l1;
list<int> :: iterator l1_iter;
int v1 = 10;
int v2 = 5;
l1.push_back(v1);
l1.push_back(v2);
l1.push_back(50);
l1.push_back(100);
l1_iter = find(l1.begin(), l1.end(), 50);

I have written this code, i want to search 50 in my list. Is there away to know if i found or not?

Aucun commentaire:

Enregistrer un commentaire