#include <iostream>
#include <vector>
#include <algorithm>

void double_number(int &num) {
    num *= 2;
}

int main() {
    std::vector<int> numbers = {1, 2, 3, 4, 5};

    // 使用 std::for_each() 函数将向量中的每个元素加倍
    std::for_each(numbers.begin(), numbers.end(), double_number);

    // 输出加倍后的向量
    std::cout << "Doubled numbers: ";
    for (const auto &num : numbers) {
        std::cout << num << " ";
    }
    std::cout << std::endl;

    return 0;
}
