[C++] Looking for an easy syntax learning tool

Learning syntax alone seems incredibly pointless to me... But I guess I'll give you the very primitive Python equivalents.

Note that probably none of these things will translate cleanly, if you don't understand what you're doing in a C++ context, you're doing it wrong. C++ is significantly more complicated than Python.

#include <iostream>
#include <string>

// Function prototypes.
bool is_even(const int);
void fill_array(char[], const int);

int
main(void)
{
    // Print to stdout/stderr streams.
    std::cout << "Hello, world!" << std::endl;
    std::cerr << "Goodbye, world!" << std::endl;

    // Declare and initialize a handful of primitive types.
    int i = 0, i2 = 0;
    unsigned int u_i = 0;
    short s = 0;
    long l = 0;
    long long ll = 0;
    float f = 0.0;
    double d = 0.0;
    char c = '\0';

    // Simple, error prone stdin stream reading.
    std::cout << "How old are you? ";
    int age = 0;
    std::cin >> age;

    // Simple logical branching.
    if (0 < age && age <= 120) {
        std::cout << "You are alive!" << std::endl;
    } else if (age > 120) {
        std::cout << "You are extremely old." << std::endl;
    } else {
        std::cout << "You haven't been born yet." << std::endl;
    }

    // Call a function and utilize its return value.
    if (is_even(age)) std::cout << "Your age is an even number.\n";
    else std::cout << "Your age is an odd number.\n";

    // Declare an array, allocate memory space for its elements, and 
    // initialize elements to the null value of the type.
    const int buf_sze = 26;
    char alpha[buf_sze] = { 0 };

    // Pass a pointer of the array in to a function that will modify the
    // memory space of the array pointed to.
    fill_array(alpha, buf_sze);

    // Count to ten with a while/for loop.
    int count = 1;
    while (count++ < 10) { // Post-increment operator use here.
        std::cout << count << std::endl;
    }

    // The previous is interchangeable with a do...while.
    do {
        continue;   
    } while (false); // Condition check at the end;

    for (int count = 1; count <= 10; ++count) { // Pre-increment operator.
        std::cout << count << std::endl;
    }

    // Switch/case fall through logic.
    std::cout << "Enter a day of the week number value (1-7): ";
    int day = 0;
    std::cin >> day;
    switch (day) {
        case 0: case 1: case 2: case 3: case 4: case 5:
            std::cout << "That is a week day.\n";
            break;
        case 6: case 7:
            std::cout << "That is a weekend.\n";
            break;
        default:
            std::cout << "That is a day that I don't know.\n";
    }

    // Return the all clear message to the calling process.
    return 0;
}

// Function declarations.
bool is_even(const int n)
{
    return n % 2 == 0;
}

void fill_array(char arr[], const int size)
{
    // Iterate through array elements and assign to corresponding
    // letter of the alphabet.
    for (int i = 0; i < size; i++) {

        // Explicitly cast the result of the arithmetic expression
        // back to a char data type. Precision could potentially be
        // lost after this operation.
        arr[i] = (char) 'a' + i;

        std::cout << arr[i];
    }
    std::cout << std::endl;
}
/r/learnprogramming Thread