CJCoding With Joseph
15free / daySign inCreate account

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, so 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.