CJCoding With Joseph
15free / daySign inCreate account

find Returns an Iterator

A vector v has already been created with the values {10, 20, 30, 40} and an int target set to 30. Search for target with find (from <algorithm>). If it is found, print Found at index  followed by its position (0-based, computed as the distance from v.begin() to the returned iterator). If it is not found, print Not 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
Topics:
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.