• 0 Posts
  • 31 Comments
Joined 1 year ago
cake
Cake day: June 24th, 2023

help-circle






  • 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)





  • What’s “space!” and “enter”?

    For those that need help in deciphering the title text, there is a super easy trick: Take the last 5 bits of each byte, convert them from binary to decimal, and that letter of the alphabet (starting from one) is the letter represented by the ASCII code.

    To convert binary numbers to decimal, just add the place values of a the 1s together. For 5 bits, the place values are 16, 8, 4, 2, 1. So 10110 becomes 16+4+2 which is equal to 22.

    01001101: last 5 bits are 01101, in decimal, that is 8+4+1=13, and the 13th letter of the alphabet is “m”

    01100101, becomes 00101, then 4+1=5, and the 5th letter of the alphabet is ‘e’

    The last 2 are just repeats of those, so the post body reads “meme” (if the third bit is zero, the letter is capital, so it should really be “Meme”)