这篇趣文有一定历史了,应该至少有 10 年了。 PS:亮点总是在最后。:) 初中/高中(注:Basic) 大一(注:Pascal) 3 | writeln ( 'Hello, world!' ) |
大三/大四 3 | (cons 'Hello (list 'World)))) |
入职第一年 04 | char *message[] = { "Hello " , "World" }; |
07 | for (i = 0; i < 2; ++i) |
08 | printf ( "%s" , message[i]); |
入职干了几年 10 | string() : size(0), ptr( new char [1]) { ptr[0] = 0; } |
12 | string( const string &s) : size(s.size) |
14 | ptr = new char [size + 1]; |
23 | friend ostream &operator <<(ostream &, const string &); |
24 | string &operator=( const char *); |
27 | ostream &operator<<(ostream &stream, const string &s) |
29 | return (stream << s.ptr); |
32 | string &string::operator=( const char *chrs) |
38 | ptr = new char [size + 1]; |
大师程序员 002 | uuid (2573F8F4-CFEE-101A-9A9F-00AA00342820) |
007 | importlib( "actimp.tlb" ); |
008 | importlib( "actexp.tlb" ); |
014 | uuid (2573F8F5-CFEE-101A-9A9F-00AA00342820) |
019 | interface IPersistFile; |
025 | uuid (2573F890-CFEE-101A-9A9F-00AA00342820) |
031 | importheader(<windows.h>); |
032 | importheader(<ole2.h>); |
033 | importheader(<except.hxx>); |
034 | importheader( "pshlo.h" ); |
035 | importheader( "shlo.hxx" ); |
036 | importheader( "mycls.hxx" ); |
039 | importlib( "actimp.tlb" ); |
040 | importlib( "actexp.tlb" ); |
041 | importlib( "thlo.tlb" ); |
044 | uuid (2573F891-CFEE-101A-9A9F-00AA00342820), |
055 | extern HANDLE hEvent; |
057 | class CHello : public CHelloBase |
062 | CHello(IUnknown *pUnk); |
065 | HRESULT __stdcall PrintSz( LPWSTR pwszString); |
080 | int CHello::cObjRef = 0; |
082 | CHello::CHello(IUnknown *pUnk) : CHelloBase(pUnk) |
088 | HRESULT __stdcall CHello::PrintSz( LPWSTR pwszString) |
092 | return (ResultFromScode(S_OK)); |
095 | CHello::~CHello( void ) |
119 | DWORD dwRegistration; |
120 | CHelloCF *pCF = new CHelloCF(); |
122 | hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); |
125 | CoInitializeEx(NULL, COINIT_MULTITHREADED); |
127 | CoRegisterClassObject(CLSID_CHello, pCF, CLSCTX_LOCAL_SERVER, |
128 | REGCLS_MULTIPLEUSE, &dwRegistration); |
131 | WaitForSingleObject(hEvent, INFINITE); |
134 | CoRevokeClassObject(dwRegistration); |
135 | ulRef = pCF->Release(); |
142 | extern CLSID CLSID_CHello; |
143 | extern UUID LIBID_CHelloLib; |
145 | CLSID CLSID_CHello = { |
149 | { 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 } |
152 | UUID LIBID_CHelloLib = { |
156 | { 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 } |
176 | WCHAR wcsT[_MAX_PATH]; |
177 | WCHAR wcsPath[2 * _MAX_PATH]; |
183 | mbstowcs (wcsPath, argv[1], strlen (argv[1]) + 1); |
187 | fprintf (stderr, "Object path must be specified\n" ); |
193 | mbstowcs (wcsT, argv[2], strlen (argv[2]) + 1); |
195 | wcscpy(wcsT, L "Hello World" ); |
197 | printf ( "Linking to object %ws\n" , wcsPath); |
198 | printf ( "Text String %ws\n" , wcsT); |
201 | hRslt = CoInitializeEx(NULL, COINIT_MULTITHREADED); |
203 | if (SUCCEEDED(hRslt)) { |
205 | hRslt = CreateFileMoniker(wcsPath, &pmk); |
207 | hRslt = BindMoniker(pmk, 0, IID_IHello, ( void **)&pHello); |
209 | if (SUCCEEDED(hRslt)) { |
212 | pHello->PrintSz(wcsT); |
215 | ulCnt = pHello->Release(); |
218 | printf ( "Failure to connect, status: %lx" , hRslt); |
新手黑客 02 | $msg = "Hello, world.\n" ; |
04 | while ( defined ( $arg = shift ( @ARGV ))) { |
06 | open (FILE, ">" . $outfilename ) || die "Can't write $arg: $!\n" ; |
08 | close (FILE) || die "Can't close $arg: $!\n" ; |
有经验的黑客 2 | #define S "Hello, World\n" |
3 | main(){ exit ( printf (S) == strlen (S) ? 0 : 1);} |
入行干过好些年的黑客 1 | % cc -o a.out ~/src/misc/hw/hw.c |
黑客大师 新手经理 中级经理 1 | mail -s "Hello, world." bob@b12 |
2 | 鲍勃,你能帮我写个输出“Hello, world.”的程序么? |
高级经理 2 | Jim,我今天下午就要输出 “Hello, world.” 的程序! |
CEO/首席执行官
2 | letter: Command not found. |
6 | help: Command not found. |
|