Skip to content
RapidFinger — free online typing test

Typing tests

← All programming languages

C++ Coding Practice

Practice typing real code syntax, including brackets, punctuation, and indentation. Snippets are for typing practice only and are never executed.

Function and condition

#include <iostream>

int main() {
    int number = 8;
    std::cout << (number % 2 == 0 ? "even" : "odd") << '\n';
    return 0;
}

Loops and conditions

#include <iostream>
#include <vector>

int main() {
    std::vector<int> numbers = {3, 8, 12, 5, 10};

    for (int number : numbers) {
        if (number % 2 == 0) {
            std::cout << number << '\n';
        }
    }

    return 0;
}

Sort a vector

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

int main() {
    std::vector<int> values{9, 2, 7, 1, 5};

    std::sort(values.begin(), values.end());

    for (int value : values) {
        std::cout << value << " ";
    }

    std::cout << '\n';
    return 0;
}