← Back to STL Containers
Question 551
Dereference and Advance
Dereference and Advance
A vectorvhas already been created with the values {10, 20, 30}. Complete the TODOs so the program: 1. creates an iteratoritpointing 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
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.