← Back to STL Containers
Question 556
find Returns an Iterator
find Returns an Iterator
A vectorvhas already been created with the values {10, 20, 30, 40} and an inttargetset to 30. Search fortargetwithfind(from<algorithm>). If it is found, printFound at indexfollowed by its position (0-based, computed as the distance fromv.begin()to the returned iterator). If it is not found, printNot found. Either way end the line with a newline.
Expected Output:
Found at index 2= newline. The output ends with a newline — print one after the last line.
Hints4 available
Sign in to use hintsTopics:
STL ContainersIterators
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.