• nothacking@discuss.tchncs.de
    link
    fedilink
    arrow-up
    11
    ·
    edit-2
    11 months ago

    This just prints:

    💩
    🍊
    🍉
    🍉
    🍍
    🍎
    

    Line 38 and 39 just check if a function that always returns false is false and if so, prints “💩\n”. (C++ uses the bit shift operator for file IO for some reason)

    Line 41 creates a vector of shared pointers to an abstract class, or in other words, an array of functions. Each function prints the emoji, mostly the same as the name, but not always. ( 🍒 is the exception, it prints “🍉\n”)

    43 and 44 just loop over the array and call every function inside, printing a bunch of emoji.

    Line 46 returns the result of std::rand(), but because the programer forgot to call srand, the result is always the same (1804289383 for me).

    (There are also a few missing includes, but I doubt this is intentional)