Opening the reading…
Opening the reading…
PROGRAMMING FUNDAMENTALS › C++ FUNDAMENTALS
This is a scratch drill — your code runs, nothing is graded or recorded. No test cases, no expected output, no verdict.
TASK
Complete the program so it performs the exact sequence after reserve(6): push_back(1), v[1] = 5, and pop_back(). After each modifying operation, print the vector values, its size, and its valid last element without reading reserved storage.
OUTPUT
Samplev: [4, 2, 7, 1], size: 4, last: 1 v: [4, 5, 7, 1], size: 4, last: 1 v: [4, 5, 7], size: 3, last: 7
What a finished answer prints, from the lesson. Nothing has run yet — press Run and this is replaced by your program’s own output.