Challenge 1: Sorting a Vector and Printing With an Explicit Iterator Loop — Possible Solution ==================================================================== #include #include #include int main() { std::vector nums = {40, 10, 30, 20, 50}; std::sort(nums.begin(), nums.end()); for (auto it = nums.begin(); it != nums.end(); ++it) { std::cout << *it << std::endl; } return 0; } Output: 10 20 30 40 50 WHY THIS WORKS AS AN ANSWER ------------------------------ std::sort(nums.begin(), nums.end()) sorts the vector in place using only its begin/end iterators, with no knowledge of what specific container type it's operating on -- exactly the chapter's own "algorithms don't care which container" point. The printing loop uses the explicit it != nums.end() / ++it / *it pattern rather than a range-based for, matching what the chapter states that syntax actually expands to underneath.