Answers for "find function in c++"

C++
5

vector.find()

#include <algorithm>
#include <vector>

if ( std::find(vec.begin(), vec.end(), item) != vec.end() )
   do_this();
else
   do_that();
Posted by: Guest on July-09-2020
2

find function in c++

// find function for strings
// my linkedin : https://www.linkedin.com/in/vaalarivan-prasanna-3a07bb203/
str = "Ilayathapathy";
subStr = "thalapathy";
cout << str.find(subStr, 1);  // prints 5 (first occurrence of substring \n
// starting at index 1
Posted by: Guest on May-10-2021

Browse Popular Code Answers by Language