Hello World!

古城微笑少年丶 2022-05-16 09:23 544阅读 0赞

How the way people code “Hello World” varies depending on their age and job:

High School/Jr. High

  1. 10 PRINT "HELLO WORLD"
  2. 20 END

First year in College

  1. program Hello(input, output)
  2. begin
  3. writeln('Hello World')
  4. end.

Senior year in College

  1. (defun hello
  2. (print
  3. (cons 'Hello (list 'World))))

New professional

  1. #include <stdio.h>
  2. void main(void)
  3. {
  4. char *message[] = {"Hello ", "World"};
  5. int i;
  6. for(i = 0; i < 2; ++i)
  7. printf("%s", message[i]);
  8. printf("/n");
  9. }

Seasoned professional

  1. #include <iostream.h>
  2. #include <string.h>
  3. class string
  4. {
  5. private:
  6. int size;
  7. char *ptr;
  8. public:
  9. string() : size(0), ptr(new char('/0')) {}
  10. string(const string &s) : size(s.size)
  11. {
  12. ptr = new char[size + 1];
  13. strcpy(ptr, s.ptr);
  14. }
  15. ~string()
  16. {
  17. delete [] ptr;
  18. }
  19. friend ostream &operator <<(ostream &, const string &);
  20. string &operator=(const char *);
  21. };
  22. ostream &operator<<(ostream &stream, const string &s)
  23. {
  24. return(stream << s.ptr);
  25. }
  26. string &string::operator=(const char *chrs)
  27. {
  28. if (this != &chrs)
  29. {
  30. delete [] ptr;
  31. size = strlen(chrs);
  32. ptr = new char[size + 1];
  33. strcpy(ptr, chrs);
  34. }
  35. return(*this);
  36. }
  37. int main()
  38. {
  39. string str;
  40. str = "Hello World";
  41. cout << str << endl;
  42. return(0);
  43. }

System Administrator

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. main()
  4. {
  5. char *tmp;
  6. int i=0;
  7. /* on y va bourin */
  8. tmp=(char *)malloc(1024*sizeof(char));
  9. while (tmp[i]="Hello Wolrd"[i++]);
  10. /* Ooopps y'a une infusion ! */
  11. i=(int)tmp[8];
  12. tmp[8]=tmp[9];
  13. tmp[9]=(char)i;
  14. printf("%s/n",tmp);
  15. }

Apprentice Hacker

  1. #!/usr/local/bin/perl
  2. $msg="Hello, world./n";
  3. if ($#ARGV >= 0) {
  4. while(defined($arg=shift(@ARGV))) {
  5. $outfilename = $arg;
  6. open(FILE, ">" . $outfilename) || die "Can't write $arg: $!/n";
  7. print (FILE $msg);
  8. close(FILE) || die "Can't close $arg: $!/n";
  9. }
  10. } else {
  11. print ($msg);
  12. }
  13. 1;

Experienced Hacker

  1. #include <stdio.h>
  2. #include <string.h>
  3. #define S "Hello, World/n"
  4. main(){exit(printf(S) == strlen(S) ? 0 : 1);}

Seasoned Hacker

  1. % cc -o a.out ~/src/misc/hw/hw.c
  2. % a.out
  3. Hello, world.

Guru Hacker

  1. % cat
  2. Hello, world.

New Manager (do you remember?)

  1. 10 PRINT "HELLO WORLD"
  2. 20 END

Middle Manager

  1. mail -s "Hello, world." bob@b12
  2. Bob, could you please write me a program that prints "Hello, world."?
  3. I need it by tomorrow.
  4. ^D

Senior Manager

  1. % zmail jim
  2. I need a "Hello, world." program by this afternoon.

Chief Executive

  1. % letter
  2. letter: Command not found.
  3. % mail
  4. To: ^X ^F ^C
  5. % help mail
  6. help: Command not found.
  7. % damn!
  8. !: Event unrecognized
  9. % logout

Research Scientist

  1. PROGRAM HELLO
  2. PRINT *, 'Hello World'
  3. END

Older research Scientist

  1. WRITE (6, 100)
  2. 100 FORMAT (1H ,11HHELLO WORLD)
  3. CALL EXIT
  4. END

Other humor in the GNU Humor Collection.

Disclaimer

The joke on this page was obtained from the FSF’s email archives of the GNU Project.

The Free Software Foundation claims no copyright on this joke.

发表评论

表情:
评论列表 (有 0 条评论,544人围观)

还没有评论,来说两句吧...

相关阅读

    相关 Hello World

    Hello World 一、简述          简单的Hello World程序。(时间久了就会忘,趁着还有印象先记下)     1、C语言:  控制台程序、有窗体

    相关 Hello World

    这是我的第一篇博客,虽然是第一次写博客,但是之前也在微信公众号上写过一些文章(虽然没有阅读量),或多或少对自己产生了一定的帮助。 这些天会考虑将其中一些较为有意义的