11
jonjo
8y

As an exercise lets see how many different ways we can wish devRant Happy Birthday in code. Try not to copy peoples examples, use a different language or different method.

A couple of examples to start the process:

* LOLCODE *
HAI 1.3
LOL VAR R 3
IM IN YR LOOP
VISIBLE "Happy Birthday"!
IZ VAR LIEK 1?
YARLY
VISIBLE "Dear devRant"!
NOWAI
VISIBLE "to you"!
KTHX
NERFZ VAR!!
IZ VAR LIEK 0?
GTFO
KTHX
KTHX
KTHXBYE

* C *
#include <stdio.h>

#define HP "Happy birthday"
#define TY "to you"
#define DD "Dear devRant"

typedef struct HB_t { const char *s; const char *e;} HB;
static const HB hb[] = {{HP,TY}, {{HP,TY}, {{HP,DD}, {{HP,TY}, { NULL, NULL }};

int main(void)
{
const HB *s = hb;
while(s->start) { printf("%s %s", s->s, s->e); }
return 1;
}

Comments
  • 2
    Idea started from rant 477870
  • 3
    A simple one in Python 3: :P

    print('Happy Birthday, devRant')
  • 3
    print"Happy Birthday $_"for("to You\n","Dear devRant\n")[0,0,1,0]
  • 4
    foo = "\nHappy Birthday to You"
    print( (foo * 3)[:60] + "Dear devRant" + foo )
  • 5
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    static int a[] = {
    5,24,50,66,67,77,8,50,59,70,74,64,62,
    61,87,2,68,66,3,73,67,77,5,24,54,74,79,
    93,8,50,63,78,86,80,82,85,115,2,68,70,
    3,73,71,85,5,24,58,82,91,109,8,50,67,
    86,98,96,102,109,143,4,20,64,71,99,7,
    52,65,94,70,97,122,140,5,24,62,90,103,
    125,8,50,71,94,110,112,122,133,171,2,
    68,78,3,73,79,101
    };
    int main(void)
    {
    const char *t; char st[512]={0};char c;
    int e=0,i=0,y=0,u=0,n,m,l=sizeof(a)/sizeof(int);
    while(l>i){
    int m=n=a[i];i++;y++;
    while(n){c=((a[i]-(m-n?y*(m-n):0))+'0');st[e]=c;e++;n--;i++;}
    u++;
    if(i!=l){st[e]=!(u%4)?',':' ';e++;}
    if(!(u%4)){st[e]='\n';e++;}
    }
    printf("%s",st);
    return 1;
    }

    $ gcc -o hb hb.c && ./hb
    Happy birthday to you,
    Happy birthday to you,
    Happy birthday Dear devRant,
    Happy birthday to you
  • 1
    @aadarsh977 what happened to the rest of the song?
  • 1
    @jonjo Oh! I forgot that.
  • 3
    F#:

    let happyBirthday () = printfn "Happy Birthday to you!"

    happyBirthday()
    happyBirthday()
    printfn "Happy Birthday, dear devRant!"
    happyBirthday()
  • 4
    // Java

    class Application {
    private static String[] songLines = {
    "Happy birthday to you",
    "Happy birthday to you",
    "Happy birthday dear devRant",
    "Happy birthday to you"
    };
    public static main(String[] args) {
    for ( String line : songLines) {
    System.out.println(line);
    }
    }
    }
  • 5
    #import <Foundation/Foundation.h>

    int main()
    {
    /*obj-c is weird */
    NSLog("Happy birthday!");

    Return 0;
    }
  • 1
    Get sum brainfuck:

    >++++++++++
    [
    >+++++++
    >++++++++++
    >+++
    >+
    <<<<-
    ]
    >++.
    >---.
    +++
    <<+++
    [
    >>++++
    <<-
    ]
    >>..
    +++++++++.
    >++.
    <-----------------------.
    +++++++.
    +++++++++.
    ++.
    ------------.
    ----.
    ---.
    <<+++
    [
    >> ++++++++
    <<-
    ]
    >>.
  • 0
    @daintycode now I need to work out brainfuck to see your output lol
Add Comment