• 2 Posts
  • 34 Comments
Joined 2 years ago
cake
Cake day: June 3rd, 2023

help-circle








  • // Greetings, intrepid explorer, to the magnum opus of verbosity – the exhaustive elucidation
    // of the venerable "Hello, World!" program in the illustrious realm of C++.
    
    // Our inaugural act involves the summoning of external powers through the sacred rite of inclusion.
    // The venerable  library is invoked, opening the gateway to input and output sorcery.
    #include <iostream>
    
    // Brace yourself, noble adventurer, for the initiation of our journey transpires within the sanctum
    // of the 'main' function – the veritable heart and soul of our C++ odyssey.
    int main() {
        // Let us forge a pact with the realm of 'std', alleviating the syntactic tribulations
        // through the divine power of the 'using' declaration. Behold the namespace, a sanctuary
        // where the gods of C++ convene, rendering our code free from the shackles of verbosity.
        using namespace std;
    
        // As we stand on the precipice of expression, the 'cout' oracle emerges.
        // This venerable entity, an emissary of the standard output stream, awaits our command.
        // With the '<<' conjuration, we channel the essence of our proclamation, "Hello, World!",
        // and cast it into the void of the console, where it shall resonate for eternity.
        cout << "Hello, World!" << endl;
    
        // The denouement approaches, where our protagonist, the 'main' function,
        // bestows upon the cosmic arbiter – the operating system – a token of acknowledgment.
        // The triumphant 'return 0' is a symphony of numerical reverence, echoing
        // the harmony of a flawless performance in the grand opera of computational artistry.
        return 0;
    }
    







  • Sure, it’s shorter, but is it really a summary of my comment, or just a more technical explanation?

    My comment tries to teach via example, while theirs tries to teach using math. I chose my method because it’s the most accessible to people who aren’t math-inclined, but also because it takes the least cognitive effort to understand, which is an important quality for a social media comment to have nowadays.

    Besides, you obviously don’t have to read the whole table (you already know how to count to 25). Just scan the right column to see what it’s doing differently.



  • glibg10b@lemmy.mltoProgrammer Humor@lemmy.mlMerry Christmas!
    link
    fedilink
    arrow-up
    66
    arrow-down
    1
    ·
    1 year ago

    Explanation:

    In decimal (DEC), we count to 9 before adding a new digit. For example, the number after 9 is 10, and the number after 19 is 20.

    In octal (OCT), we count to 7 before adding a new digit. The number after 7 is 10 and the number after 17 is 20.

    DEC OCT
    0 0
    1 1
    2 2
    3 3
    4 4
    5 5
    6 6
    7 7
    8 10
    9 11
    10 12
    11 13
    12 14
    13 15
    14 16
    15 17
    16 20
    17 21
    18 22
    19 23
    20 24
    21 25
    22 26
    23 27
    24 30
    25 31