jangwooning 发表于 2013-7-3 09:41:27

各阶段程序员的代码

这篇趣文是以 Hello World 为例,列举处于各阶段程序员的代码。,这篇有一定历史了,应该至少有 10 年了。
PS:亮点总是在最后。:)

初中/高中(注:Basic)

[*]10 PRINT "HELLO WORLD"
[*]20 END

大一(注:Pascal)

[*]program Hallo(output);
[*]begin
[*]    writeln('Hello, world!')
[*]end.

大三/大四

[*](defun hello
[*](print
[*]    (cons 'Hello (list 'World))))

入职第一年

[*]#include <stdio.h>
[*]void main(void)
[*]{
[*]char *message[] = {"Hello ", "World"};
[*]int i;
[*]
[*]for(i = 0; i < 2; ++i)
[*]    printf("%s", message);
[*]printf("\n");
[*]}

入职干了几年

[*]#include <iostream.h>
[*]#include <string.h>
[*]
[*]class string
[*]{
[*]private:
[*]int size;
[*]char *ptr;
[*]
[*]string() : size(0), ptr(new char) { ptr = 0; }
[*]
[*]string(const string &s) : size(s.size)
[*]{
[*]    ptr = new char;
[*]    strcpy(ptr, s.ptr);
[*]}
[*]
[*]~string()
[*]{
[*]    delete [] ptr;
[*]}
[*]
[*]friend ostream &operator <<(ostream &, const string &);
[*]string &operator=(const char *);
[*]};
[*]
[*]ostream &operator<<(ostream &stream, const string &s)
[*]{
[*]return(stream << s.ptr);
[*]}
[*]
[*]string &string::operator=(const char *chrs)
[*]{
[*]if (this != &chrs)
[*]{
[*]    delete [] ptr;
[*]   size = strlen(chrs);
[*]    ptr = new char;
[*]    strcpy(ptr, chrs);
[*]}
[*]return(*this);
[*]}
[*]
[*]int main()
[*]{
[*]string str;
[*]
[*]str = "Hello World";
[*]cout << str << endl;
[*]
[*]return(0);
[*]}
大师程序员

[*][
[*]uuid(2573F8F4-CFEE-101A-9A9F-00AA00342820)
[*]]
[*]library LHello
[*]{
[*]      // bring in the master library
[*]      importlib("actimp.tlb");
[*]      importlib("actexp.tlb");
[*]
[*]      // bring in my interfaces
[*]      #include "pshlo.idl"
[*]
[*]      [
[*]      uuid(2573F8F5-CFEE-101A-9A9F-00AA00342820)
[*]      ]
[*]      cotype THello
[*]   {
[*]   interface IHello;
[*]   interface IPersistFile;
[*]   };
[*]};
[*]
[*][
[*]exe,
[*]uuid(2573F890-CFEE-101A-9A9F-00AA00342820)
[*]]
[*]module CHelloLib
[*]{
[*]
[*]      // some code related header files
[*]      importheader(<windows.h>);
[*]      importheader(<ole2.h>);
[*]      importheader(<except.hxx>);
[*]      importheader("pshlo.h");
[*]      importheader("shlo.hxx");
[*]      importheader("mycls.hxx");
[*]
[*]      // needed typelibs
[*]      importlib("actimp.tlb");
[*]      importlib("actexp.tlb");
[*]      importlib("thlo.tlb");
[*]
[*]      [
[*]      uuid(2573F891-CFEE-101A-9A9F-00AA00342820),
[*]      aggregatable
[*]      ]
[*]      coclass CHello
[*]   {
[*]   cotype THello;
[*]   };
[*]};
[*]
[*]#include "ipfix.hxx"
[*]
[*]extern HANDLE hEvent;
[*]
[*]class CHello : public CHelloBase
[*]{
[*]public:
[*]      IPFIX(CLSID_CHello);
[*]
[*]      CHello(IUnknown *pUnk);
[*]      ~CHello();
[*]
[*]      HRESULT__stdcall PrintSz(LPWSTR pwszString);
[*]
[*]private:
[*]      static int cObjRef;
[*]};
[*]
[*]#include <windows.h>
[*]#include <ole2.h>
[*]#include <stdio.h>
[*]#include <stdlib.h>
[*]#include "thlo.h"
[*]#include "pshlo.h"
[*]#include "shlo.hxx"
[*]#include "mycls.hxx"
[*]
[*]int CHello::cObjRef = 0;
[*]
[*]CHello::CHello(IUnknown *pUnk) : CHelloBase(pUnk)
[*]{
[*]      cObjRef++;
[*]      return;
[*]}
[*]
[*]HRESULT__stdcallCHello::PrintSz(LPWSTR pwszString)
[*]{
[*]      printf("%ws
[*]", pwszString);
[*]      return(ResultFromScode(S_OK));
[*]}
[*]
[*]CHello::~CHello(void)
[*]{
[*]
[*]// when the object count goes to zero, stop the server
[*]cObjRef--;
[*]if( cObjRef == 0 )
[*]      PulseEvent(hEvent);
[*]
[*]return;
[*]}
[*]
[*]#include <windows.h>
[*]#include <ole2.h>
[*]#include "pshlo.h"
[*]#include "shlo.hxx"
[*]#include "mycls.hxx"
[*]
[*]HANDLE hEvent;
[*]
[*]   int _cdecl main(
[*]int argc,
[*]char * argv[]
[*]) {
[*]ULONG ulRef;
[*]DWORD dwRegistration;
[*]CHelloCF *pCF = new CHelloCF();
[*]
[*]hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
[*]
[*]// Initialize the OLE libraries
[*]CoInitializeEx(NULL, COINIT_MULTITHREADED);
[*]
[*]CoRegisterClassObject(CLSID_CHello, pCF, CLSCTX_LOCAL_SERVER,
[*]      REGCLS_MULTIPLEUSE, &dwRegistration);
[*]
[*]// wait on an event to stop
[*]WaitForSingleObject(hEvent, INFINITE);
[*]
[*]// revoke and release the class object
[*]CoRevokeClassObject(dwRegistration);
[*]ulRef = pCF->Release();
[*]
[*]// Tell OLE we are going away.
[*]CoUninitialize();
[*]
[*]return(0); }
[*]
[*]extern CLSID CLSID_CHello;
[*]extern UUID LIBID_CHelloLib;
[*]
[*]CLSID CLSID_CHello = { /* 2573F891-CFEE-101A-9A9F-00AA00342820 */
[*]      0x2573F891,
[*]      0xCFEE,
[*]      0x101A,
[*]      { 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 }
[*]};
[*]
[*]UUID LIBID_CHelloLib = { /* 2573F890-CFEE-101A-9A9F-00AA00342820 */
[*]      0x2573F890,
[*]      0xCFEE,
[*]      0x101A,
[*]      { 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 }
[*]};
[*]
[*]#include <windows.h>
[*]#include <ole2.h>
[*]#include <stdlib.h>
[*]#include <string.h>
[*]#include <stdio.h>
[*]#include "pshlo.h"
[*]#include "shlo.hxx"
[*]#include "clsid.h"
[*]
[*]int _cdecl main(
[*]int argc,
[*]char * argv[]
[*]) {
[*]HRESULThRslt;
[*]IHello      *pHello;
[*]ULONGulCnt;
[*]IMoniker * pmk;
[*]WCHARwcsT;
[*]WCHARwcsPath;
[*]
[*]// get object path
[*]wcsPath = '\0';
[*]wcsT = '\0';
[*]if( argc > 1) {
[*]      mbstowcs(wcsPath, argv, strlen(argv) + 1);
[*]      wcsupr(wcsPath);
[*]      }
[*]else {
[*]      fprintf(stderr, "Object path must be specified\n");
[*]      return(1);
[*]      }
[*]
[*]// get print string
[*]if(argc > 2)
[*]      mbstowcs(wcsT, argv, strlen(argv) + 1);
[*]else
[*]      wcscpy(wcsT, L"Hello World");
[*]
[*]printf("Linking to object %ws\n", wcsPath);
[*]printf("Text String %ws\n", wcsT);
[*]
[*]// Initialize the OLE libraries
[*]hRslt = CoInitializeEx(NULL, COINIT_MULTITHREADED);
[*]
[*]if(SUCCEEDED(hRslt)) {
[*]
[*]      hRslt = CreateFileMoniker(wcsPath, &pmk);
[*]      if(SUCCEEDED(hRslt))
[*]   hRslt = BindMoniker(pmk, 0, IID_IHello, (void **)&pHello);
[*]
[*]      if(SUCCEEDED(hRslt)) {
[*]
[*]   // print a string out
[*]   pHello->PrintSz(wcsT);
[*]
[*]   Sleep(2000);
[*]   ulCnt = pHello->Release();
[*]   }
[*]      else
[*]   printf("Failure to connect, status: %lx", hRslt);
[*]
[*]      // Tell OLE we are going away.
[*]      CoUninitialize();
[*]      }
[*]
[*]return(0);
[*]}
新手黑客

[*]#!/usr/local/bin/perl
[*]$msg="Hello, world.\n";
[*]if ($#ARGV >= 0) {
[*]while(defined($arg=shift(@ARGV))) {
[*]    $outfilename = $arg;
[*]    open(FILE, ">" . $outfilename) || die "Can't write $arg: $!\n";
[*]    print (FILE $msg);
[*]    close(FILE) || die "Can't close $arg: $!\n";
[*]}
[*]} else {
[*]print ($msg);
[*]}
[*]1;

有经验的黑客

[*]#include <stdio.h>
[*]#define S "Hello, World\n"
[*]main(){exit(printf(S) == strlen(S) ? 0 : 1);}

入行干过好些年的黑客

[*]% cc -o a.out ~/src/misc/hw/hw.c
[*]% a.out

黑客大师

[*]% echo "Hello, world."

新手经理

[*]10 PRINT "HELLO WORLD"
[*]20 END

中级经理

[*]mail -s "Hello, world." bob@b12
[*]鲍勃,你能帮我写个输出“Hello, world.”的程序么?
[*]我明天就要。
[*]谢谢~

高级经理

[*]% zmail jim
[*]Jim,我今天下午就要输出 “Hello, world.” 的程序!

CEO/首席执行官

[*]% letter
[*]letter: Command not found.
[*]% mail
[*]To: ^X ^F ^C
[*]% help mail
[*]help: Command not found.
[*]% damn!
[*]!: Event unrecognized
[*]% logout

admin 发表于 2013-7-3 12:06:13

basic,Pascal的时代我都经历了~{:10_456:}

luozhang002 发表于 2013-7-3 12:34:26

差距是有点大呀!

hslx111 发表于 2013-7-3 12:38:05

怎么觉得像高端黑。。。

vo_ 发表于 2013-7-3 20:29:22

越后面越黑。。{:6_189:}

阎魔あい 发表于 2013-7-3 22:26:10

我本以为是技术贴…

jangwooning 发表于 2013-7-4 20:20:15

阎魔あい 发表于 2013-7-3 22:26
我本以为是技术贴…

我会发技术贴么?切~~~{:6_167:}

jangwooning 发表于 2013-7-4 20:20:41

vo_ 发表于 2013-7-3 20:29
越后面越黑。。

嘿嘿嘿嘿嘿~~~~~{:6_204:}

阎魔あい 发表于 2013-7-5 15:04:25

jangwooning 发表于 2013-7-4 20:20
我会发技术贴么?切~~~

不求上进。。。。。。。。还好意思说!{:6_208:}

阎魔あい 发表于 2013-7-6 14:47:41

再来看看还是觉得那么搞笑。。。。。

jangwooning 发表于 2013-7-8 09:07:00

阎魔あい 发表于 2013-7-6 14:47
再来看看还是觉得那么搞笑。。。。。

不要太迷恋我!{:6_164:}

阎魔あい 发表于 2013-7-8 09:30:09

jangwooning 发表于 2013-7-8 09:07
不要太迷恋我!

{:5_152:}文字文字啊亲!!!!!

jangwooning 发表于 2013-7-9 09:06:18

阎魔あい 发表于 2013-7-8 09:30
文字文字啊亲!!!!!

文字 也是我写的啊,总之就是迷恋迷恋我可以,别太迷恋容易无法自拔{:6_164:}

阎魔あい 发表于 2013-7-9 09:14:37

jangwooning 发表于 2013-7-9 09:06
文字 也是我写的啊,总之就是迷恋迷恋我可以,别太迷恋容易无法自拔

{:7_303:}最近自恋的人不少啊。。。。。。@wyc8842172 这个也让我别迷恋他。。。。。。。

jangwooning 发表于 2013-7-9 09:19:51

阎魔あい 发表于 2013-7-9 09:14
最近自恋的人不少啊。。。。。。@wyc8842172 这个也让我别迷恋他。。。。。。。

嬷嬷!你要专一啊,这种事情,只能是 迷恋我,其他人你可不能动情啊{:6_168:}

阎魔あい 发表于 2013-7-9 09:37:35

jangwooning 发表于 2013-7-9 09:19
嬷嬷!你要专一啊,这种事情,只能是 迷恋我,其他人你可不能动情啊

{:7_293:}瞬间感觉自己地位飙升有木有啊!!!!!!{:7_313:}我要好好考虑考虑~~~~

jangwooning 发表于 2013-7-9 09:58:21

阎魔あい 发表于 2013-7-9 09:37
瞬间感觉自己地位飙升有木有啊!!!!!!我要好好考虑考虑~~~~

你考虑好了 让你做皇贵妃,不再做嬷嬷了,顺便问一下 嬛嬛,改版后怎么发视频啊

阎魔あい 发表于 2013-7-9 10:12:08

jangwooning 发表于 2013-7-9 09:58
你考虑好了 让你做皇贵妃,不再做嬷嬷了,顺便问一下 嬛嬛,改版后怎么发视频啊

多谢免去默默的称呼~~~~~~
又嬛嬛了。。。。。。视频。。。。从老版我就不会发。。。。。新版。。。。。。{:7_271:}

jangwooning 发表于 2013-7-9 10:24:11

阎魔あい 发表于 2013-7-9 10:12
多谢免去默默的称呼~~~~~~
又嬛嬛了。。。。。。视频。。。。从老版我就不会发。。。。。新版。。。。。 ...

嬛嬛不要紧,朕已经发出去了 哇哈哈

阎魔あい 发表于 2013-7-9 11:40:39

jangwooning 发表于 2013-7-9 10:24
嬛嬛不要紧,朕已经发出去了 哇哈哈

好吧你厉害。。。。。我去给顶顶好了~

jangwooning 发表于 2013-7-9 13:00:17

阎魔あい 发表于 2013-7-9 11:40
好吧你厉害。。。。。我去给顶顶好了~

爱你 嬛嬛~~{:6_192:}么么

wyc8842172 发表于 2013-7-9 14:08:56

阎魔あい 发表于 2013-7-9 09:14
最近自恋的人不少啊。。。。。。@wyc8842172 这个也让我别迷恋他。。。。。。。

我改主意了,你随便迷恋我好了,因为我知道让你不要迷恋我真的有点难{:7_319:}

阎魔あい 发表于 2013-7-9 16:09:45

wyc8842172 发表于 2013-7-9 14:08
我改主意了,你随便迷恋我好了,因为我知道让你不要迷恋我真的有点难

你也发现了吗。。。。。。你身上散发出一种味道~让我不得不迷恋啊!!!快来吧我要吃红烧猪蹄!!!!{:6_205:}

阎魔あい 发表于 2013-7-9 16:13:29

jangwooning 发表于 2013-7-9 13:00
爱你 嬛嬛~~么么

把持住啊亲!!!!{:6_168:}要淡定~

jangwooning 发表于 2013-7-9 17:13:31

阎魔あい 发表于 2013-7-9 16:13
把持住啊亲!!!!要淡定~

不乐意啊! 嬛嬛{:6_191:}

阎魔あい 发表于 2013-7-9 17:17:43

jangwooning 发表于 2013-7-9 17:13
不乐意啊! 嬛嬛

昂~不乐意~~~~~~~咋办

jangwooning 发表于 2013-7-9 17:23:24

阎魔あい 发表于 2013-7-9 17:17
昂~不乐意~~~~~~~咋办

那也得爱~~~这事得听朕的旨意{:6_167:}

阎魔あい 发表于 2013-7-9 17:29:38

jangwooning 发表于 2013-7-9 17:23
那也得爱~~~这事得听朕的旨意

朕。。。。。。。这都是大爷啊。。。。。惹不起啊{:7_312:}

jangwooning 发表于 2013-7-9 17:34:55

阎魔あい 发表于 2013-7-9 17:29
朕。。。。。。。这都是大爷啊。。。。。惹不起啊

嬛嬛 听话~~~别耍小孩子脾气!{:6_173:}

wyc8842172 发表于 2013-7-9 18:28:28

阎魔あい 发表于 2013-7-9 16:09
你也发现了吗。。。。。。你身上散发出一种味道~让我不得不迷恋啊!!!快来吧我要吃红烧猪蹄!!!!{:6 ...

为什么是红烧猪蹄?为什么我有一种不祥的预感?{:7_303:}

阎魔あい 发表于 2013-7-10 09:45:31

wyc8842172 发表于 2013-7-9 18:28
为什么是红烧猪蹄?为什么我有一种不祥的预感?

你第六感还挺准~~~我想着吧。。。。。这活者现宰的肯定是好吃啊~~~~~{:5_136:}

阎魔あい 发表于 2013-7-10 09:47:51

jangwooning 发表于 2013-7-9 17:34
嬛嬛 听话~~~别耍小孩子脾气!

{:5_134:}这么说我也是皇室的人了!!!

wyc8842172 发表于 2013-7-10 11:55:34

阎魔あい 发表于 2013-7-10 09:45
你第六感还挺准~~~我想着吧。。。。。这活者现宰的肯定是好吃啊~~~~~

我已经开启了第七感{:7_272:}

阎魔あい 发表于 2013-7-10 12:06:41

wyc8842172 发表于 2013-7-10 11:55
我已经开启了第七感

那不也是被宰的命。。。。。别挣扎了~~~~

jangwooning 发表于 2013-7-10 12:59:32

阎魔あい 发表于 2013-7-9 16:09
你也发现了吗。。。。。。你身上散发出一种味道~让我不得不迷恋啊!!!快来吧我要吃红烧猪蹄!!!!{:6 ...

嬛嬛,wc是男银还是女银啊?怎么能这么对你呢?

jangwooning 发表于 2013-7-10 13:00:23

阎魔あい 发表于 2013-7-10 09:47
这么说我也是皇室的人了!!!

稳稳的 皇室啊~~你就是朕的 魔贵妃

Almighty 发表于 2013-7-10 13:28:32

果断是高级黑哦。

阎魔あい 发表于 2013-7-10 16:31:21

jangwooning 发表于 2013-7-10 13:00
稳稳的 皇室啊~~你就是朕的 魔贵妃

魔贵妃。。。。亏你想得出,感觉我像走火入魔的

阎魔あい 发表于 2013-7-10 16:32:03

jangwooning 发表于 2013-7-10 12:59
嬛嬛,wc是男银还是女银啊?怎么能这么对你呢?

他说他的性别现在还在探究中。。。。。。。。。生理上貌似是男僧,心理上。。。有点像变态~

jangwooning 发表于 2013-7-10 17:01:45

阎魔あい 发表于 2013-7-10 16:31
魔贵妃。。。。亏你想得出,感觉我像走火入魔的

那你说 封你个什么名字呢 嬛嬛{:7_281:}

jangwooning 发表于 2013-7-10 17:03:10

阎魔あい 发表于 2013-7-10 16:32
他说他的性别现在还在探究中。。。。。。。。。生理上貌似是男僧,心理上。。。有点像变态~

这个世界太可怕了,奥特曼快还我小宇宙 , 这句话就是这个意思 嬛嬛 哈哈 在这个语境下明白了吧 哈哈{:7_270:}

阎魔あい 发表于 2013-7-10 17:16:53

jangwooning 发表于 2013-7-10 17:03
这个世界太可怕了,奥特曼快还我小宇宙 , 这句话就是这个意思 嬛嬛 哈哈 在这个语境下明白了吧 哈哈{:7_ ...

{:6_207:好深奥的样子。。。。。。。。

阎魔あい 发表于 2013-7-10 17:17:21

jangwooning 发表于 2013-7-10 17:01
那你说 封你个什么名字呢 嬛嬛

那。。。。就这么叫吧。。。。起名字我没天赋啊。。。{:7_271:}

wyc8842172 发表于 2013-7-11 08:31:47

阎魔あい 发表于 2013-7-10 12:06
那不也是被宰的命。。。。。别挣扎了~~~~

你宰或不宰,我就在这里{:7_249:}

阎魔あい 发表于 2013-7-11 09:49:35

wyc8842172 发表于 2013-7-11 08:31
你宰或不宰,我就在这里

去屎去屎!!!!!气死我了!!!!!{:7_308:}

wyc8842172 发表于 2013-7-12 17:23:22

阎魔あい 发表于 2013-7-11 09:49
去屎去屎!!!!!气死我了!!!!!

啊,我还没去,你怎么先死了?{:7_241:}

阎魔あい 发表于 2013-7-12 17:28:17

wyc8842172 发表于 2013-7-12 17:23
啊,我还没去,你怎么先死了?

你是想气死我吗。。。。昂???!!!!!!{:7_318:}

wyc8842172 发表于 2013-7-13 01:55:08

阎魔あい 发表于 2013-7-12 17:28
你是想气死我吗。。。。昂???!!!!!!

乖啦,不生气哦{:7_279:}

阎魔あい 发表于 2013-7-13 09:36:17

wyc8842172 发表于 2013-7-13 01:55
乖啦,不生气哦

能不气吗!!!你说不气就不气啊!谁惹得我!请我吃饭就原谅你

wyc8842172 发表于 2013-7-14 00:29:35

阎魔あい 发表于 2013-7-13 09:36
能不气吗!!!你说不气就不气啊!谁惹得我!请我吃饭就原谅你

好呀,请来苏州领取你的餐券{:7_281:}
页: [1] 2 3
查看完整版本: 各阶段程序员的代码