Challenge 1: A std::vector With Five Pushed Values — Possible Solution ==================================================================== #include #include int main() { std::vector nums; nums.push_back(10); nums.push_back(20); nums.push_back(30); nums.push_back(40); nums.push_back(50); for (int i = 0; i < nums.size(); i++) { std::cout << nums[i] << std::endl; } return 0; } Output: 10 20 30 40 50 WHY THIS WORKS AS AN ANSWER ------------------------------ Five push_back calls grow the vector one element at a time, with no manual malloc/free anywhere in this code -- the vector manages its own memory internally via RAII, exactly as the chapter describes. The indexed loop uses nums.size() (an O(1) call, unlike c1-8's own O(n) strlen) as the bound and operator[] to access each element in order.