Jump to content
Sign in to follow this  
fredericopissarra

Respondendo a perguntas óbvias...

Recommended Posts

/* boo.c

  Compile com:
    gcc -o boo boo.c 
*/
#include <stdio.h>

int main( void )
{
  static char tbl[] = { 
  28, ' ', 4, 'o', 12, '$', 4, 'o', 1, '\n', 24, ' ', 2, 'o', 24, '$', 1, 'o', 
  1, '\n', 21, ' ', 2, 'o', 30, '$', 1, 'o', 9, ' ', 1, 'o', 1, '$', 3, ' ', 
  2, '$', 1, ' ', 1, 'o', 1, '$', 1, '\n', 5, ' ', 1, 'o', 1, ' ', 1, '$', 
  1, ' ', 2, 'o', 8, ' ', 1, 'o', 36, '$', 1, 'o', 7, ' ', 2, '$', 1, ' ', 
  2, '$', 1, ' ', 2, '$', 1, 'o', 1, '$', 1, '\n', 2, ' ', 2, 'o', 1, ' ', 
  1, '$', 1, ' ', 1, '$', 1, ' ', 1, '"', 1, '$', 6, ' ', 1, 'o', 9, '$', 
  4, ' ', 13, '$', 4, ' ', 9, '$', 1, 'o', 7, ' ', 3, '$', 1, 'o', 2, '$', 
  1, 'o', 1, '$', 1, '\n', 2, ' ', 1, '"', 6, '$', 1, 'o', 1, '$', 5, ' ', 
  1, 'o', 9, '$', 6, ' ', 11, '$', 6, ' ', 10, '$', 1, 'o', 4, ' ', 8, '$', 
  1, '\n', 4, ' ', 7, '$', 4, ' ', 11, '$', 6, ' ', 11, '$', 6, ' ', 23, '$', 
  1, '\n', 4, ' ', 23, '$', 4, ' ', 13, '$', 4, ' ', 14, '$', 2, ' ', 3, '"', 
  3, '$', 1, '\n', 5, ' ', 1, '"', 3, '$', 4, '"', 49, '$', 5, ' ', 1, '"', 
  3, '$', 1, '\n', 6, ' ', 3, '$', 3, ' ', 1, 'o', 50, '$', 5, ' ', 1, '"', 
  3, '$', 1, 'o', 1, '\n', 5, ' ', 1, 'o', 2, '$', 1, '"', 3, ' ', 51, '$', 
  7, ' ', 3, '$', 1, 'o', 1, '\n', 5, ' ', 3, '$', 4, ' ', 45, '$', 1, '"', 
  1, ' ', 1, '"', 6, '$', 5, 'o', 4, '$', 1, 'o', 1, '\n', 4, ' ', 1, 'o', 
  3, '$', 4, 'o', 5, '$', 2, ' ', 37, '$', 3, ' ', 1, 'o', 17, '$', 1, '\n', 
  4, ' ', 8, '$', 1, '"', 4, '$', 3, ' ', 34, '$', 5, ' ', 4, '$', 8, '"', 
  1, '\n', 3, ' ', 4, '"', 7, ' ', 4, '$', 4, ' ', 1, '"', 28, '$', 1, '"', 
  6, ' ', 1, 'o', 3, '$', 1, '\n', 14, ' ', 1, '"', 3, '$', 1, 'o', 5, ' ', 
  3, '"', 18, '$', 1, '"', 2, '$', 1, '"', 9, ' ', 3, '$', 1, '\n', 16, ' ', 
  3, '$', 1, 'o', 10, ' ', 1, '"', 2, '$', 2, '"', 6, '$', 4, '"', 11, ' ', 
  1, 'o', 3, '$', 1, '\n', 17, ' ', 4, '$', 1, 'o', 32, ' ', 1, 'o', 3, '$', 
  1, '"', 1, '\n', 18, ' ', 1, '"', 4, '$', 1, 'o', 6, ' ', 1, 'o', 6, '$', 
  1, 'o', 1, '"', 4, '$', 1, 'o', 8, ' ', 1, 'o', 4, '$', 1, '\n', 20, ' ', 
  1, '"', 5, '$', 2, 'o', 5, ' ', 2, '"', 4, '$', 1, 'o', 5, '$', 1, 'o', 
  3, ' ', 1, 'o', 4, '$', 2, '"', 1, '\n', 23, ' ', 2, '"', 5, '$', 4, 'o', 
  2, ' ', 1, '"', 3, '$', 1, 'o', 9, '$', 3, '"', 1, '\n', 26, ' ', 2, '"', 
  7, '$', 2, 'o', 1, ' ', 10, '$', 1, '\n', 34, ' ', 4, '"', 11, '$', 1, '\n', 
  38, ' ', 12, '$', 1, '\n', 39, ' ', 10, '$', 1, '"', 1, '\n', 40, ' ', 1, '"', 
  3, '$', 4, '"', 1, '\n',  0 };

  char *p = tbl;
  char c, len;

  while ( *p )
  {
    len = *p++;
    c = *p++;

    while ( len-- ) 
    {
#ifdef __WIN32
      if ( c == '\n' )
      {
        fputs( "\r\n", stdout );
        continue;
      }
#endif

      putchar( c );
    }
  }
}

Antes que perguntem... roubei isso de um "easter egg" do VIM.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...