Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
jonjo9428y#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 -
osmarks8668yF#:
let happyBirthday () = printfn "Happy Birthday to you!"
happyBirthday()
happyBirthday()
printfn "Happy Birthday, dear devRant!"
happyBirthday() -
// 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);
}
}
} -
f03n1x65038y#import <Foundation/Foundation.h>
int main()
{
/*obj-c is weird */
NSLog("Happy birthday!");
Return 0;
} -
Get sum brainfuck:
>++++++++++
[
>+++++++
>++++++++++
>+++
>+
<<<<-
]
>++.
>---.
+++
<<+++
[
>>++++
<<-
]
>>..
+++++++++.
>++.
<-----------------------.
+++++++.
+++++++++.
++.
------------.
----.
---.
<<+++
[
>> ++++++++
<<-
]
>>.
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;
}
undefined