净 WPM0
WPM0
准确率100%
已用时间0s
时间—
字符数0
错误字符0
错误数0
进度0%
阅读代码练习指南
编程语言
C++
难度
中等

Use a range-based loop to total vector values.

#include <iostream>
#include <vector>

int main() {
    std::vector<int> values{4, 8, 15, 16, 23, 42};
    int total = 0;

    for (int value : values) {
        total += value;
    }

    std::cout << total << '\n';
}