CJCoding With Joseph
15free / daySign inCreate account

Dereference and Advance

A vector v has already been created with the values {10, 20, 30}. Complete the TODOs so the program:
1. creates an iterator it pointing at the first element (v.begin()),
2. prints the element it points at, followed by a newline,
3. advances the iterator by one with ++it,
4. prints the new element it points at, followed by a newline.

Expected Output:

10
20

= newline. The output ends with a newline — print one after the last line.

Hints3 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.