From a0ef1bce32fce932ad20d2c9be64248f666e3fed Mon Sep 17 00:00:00 2001 From: Anand Soni <76837650+prototype47@users.noreply.github.com> Date: Thu, 27 Oct 2022 14:24:22 +0530 Subject: [PATCH] Update cpp-stl-cheatsheet.md --- CheatSheets/cpp-stl-cheatsheet.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CheatSheets/cpp-stl-cheatsheet.md b/CheatSheets/cpp-stl-cheatsheet.md index f2f0356..2ed9891 100644 --- a/CheatSheets/cpp-stl-cheatsheet.md +++ b/CheatSheets/cpp-stl-cheatsheet.md @@ -9,6 +9,7 @@ - [Vector sort](#vector) - [Vector reverse](#vector) - [Vector deletion](#vector) + - [Vector find](#vector) - [Set](#set) - [Set insertion](#set) - [Set Display](#set) @@ -93,6 +94,15 @@ { cout << v[i] << " "; } + + //Vector find + int search = 30; + vector::iterator it; + it = find(v.begin(), v.end(), search); + if(it != v.end()) + { + cout << "Position: " << it + v.begin() << endl; + } ``` **[🔼Back to Top](#table-of-contents)**