|
Mocii.com > Stupid & Funny > Hello World Hello World29 December 2007. author: Dr. John Zoidberg
|
Hello WorldHow the way people code "Hello World" varies depending on their age and job: High School/Jr.High 10 PRINT "HELLO WORLD"<br /> 20 END First year in College program Hello(input, output)<br /> begin<br /> writeln('Hello World')<br /> end. Senior year in College (defun hello<br /> (print<br /> (cons 'Hello (list 'World)))) New professional #include <stdio.h><br /> <br /> void main(void)<br /> {<br /> char *message[] = {"Hello ", "World"};<br /> int i;<br /> for(i = 0; i < 2; ++i)<br /> printf("%s", message[i]);<br /> printf("\n");<br /> } Seasoned professional #include <iostream.h><br /> #include <string.h><br /> class string<br /> {<br /> private:<br /> int size;<br /> char *ptr;<br /> public:<br /> string() : size(0), ptr(new char('\0')) {}<br /> string(const string &s) : size(s.size)<br /> {<br /> ptr = new char[size + 1];<br /> strcpy(ptr, s.ptr);<br /> }<br /> ~string()<br /> {<br /> delete [] ptr;<br /> }<br /> friend ostream &operator <<(ostream &, const string &);<br /> string &operator=(const char *);<br /> };<br /> <br /> ostream &operator<<(ostream &stream, const string &s)<br /> {<br /> return(stream << s.ptr);<br /> }<br /> string &string::operator=(const char *chrs)<br /> {<br /> if (this != &chrs)<br /> {<br /> delete [] ptr;<br /> size = strlen(chrs);<br /> ptr = new char[size + 1];<br /> strcpy(ptr, chrs);<br /> }<br /> return(*this);<br /> }<br /> int main()<br /> {<br /> string str;<br /> str = "Hello World";<br /> cout << str << endl;<br /> return(0);<br /> } System Administrator #include <stdio.h><br /> #include <stdlib.h><br /> main()<br /> {<br /> char *tmp;<br /> int i=0;<br /> /* on y va bourin */<br /> tmp=(char *)malloc(1024*sizeof(char));<br /> while (tmp[i]="Hello Wolrd"[i++]);<br /> /* Ooopps y'a une infusion ! */<br /> i=(int)tmp[8];<br /> tmp[8]=tmp[9];<br /> tmp[9]=(char)i;<br /> printf("%s\n",tmp);<br /> } Apprentice Hacker #!/usr/local/bin/perl<br /> $msg="Hello, world.\n";<br /> if ($#ARGV >= 0) {<br /> while(defined($arg=shift(@ARGV))) {<br /> $outfilename = $arg;<br /> open(FILE, ">" . $outfilename) || die "Can't write $arg: $!\n";<br /> print (FILE $msg);<br /> close(FILE) || die "Can't close $arg: $!\n";<br /> }<br /> } else {<br /> print ($msg);<br /> }<br /> 1; Experienced Hacker #include <stdio.h><br /> #include <string.h><br /> #define S "Hello, World\n"<br /> main(){exit(printf(S) == strlen(S) ? 0 : 1);} Seasoned Hacker % cc -o a.out ~/src/misc/hw/hw.c<br /> % a.out<br /> Hello, world. Guru Hacker % cat<br /> Hello, world. New Manager (do you remember?) 10 PRINT "HELLO WORLD"<br /> 20 END Middle Manager mail -s "Hello, world." bob@b12<br /> Bob, could you please write me a program that prints "Hello, world."?<br /> I need it by tomorrow.<br /> ^D Senior Manager % zmail jim<br /> I need a "Hello, world." program by this afternoon. Chief Executive % letter<br /> letter: Command not found.<br /> % mail<br /> To: ^X ^F ^C<br /> % help mail<br /> help: Command not found.<br /> % damn!<br /> !: Event unrecognized<br /> % logout Research Scientist PROGRAM HELLO<br /> PRINT *, 'Hello World'<br /> END Older research Scientist WRITE (6, 100)<br /> 100 FORMAT (1H ,11HHELLO WORLD)<br /> CALL EXIT<br /> END |