Netto WPM0
WPM0
Nauwkeurigheid100%
Verstreken0s
Tijd—
Tekens0
Onjuist0
Fouten0
Vooruitgang0%
Caps Lock aan

Lees de codepromptgids

Programmeertaal
C++
Moeilijkheidsgraad
Gemiddeld

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';
}