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
Process the pushes 4, 2, 7, and 1 using an int array, size, and capacity. Replace and copy the array only when size equals capacity, append the new value, and print the vector state after each push.
OUTPUT
Samplesize=1 capacity=1 values=4 size=2 capacity=2 values=4 2 size=3 capacity=4 values=4 2 7 size=4 capacity=4 values=4 2 7 1
What a finished answer prints, from the lesson. Nothing has run yet — press Run and this is replaced by your program’s own output.