From: http://www.blogjava.net/flyingbug/archive/2006/05/18/46862.html
Interesting articles !! It is recommended !! Hope so !!!
/*-------------------------------------------
Programmer evolution-from students to CEOs
Wang Yonggang http://www.contextfree.net/
Translated from Omri's computer humor page
Http://www.cs.bgu.ac.il /~ Omri/humor/
-------------------------------------------*/
--------------------------------------------------------------------------------
Middle School
10 print "Hello World"
20 end
--------------------------------------------------------------------------------
Freshman
Program Hello (input, output)
Begin
Writeln ('Hello World ')
End.
--------------------------------------------------------------------------------
Senior Students
(Defun hello
(Print
(Cons 'Hello (list 'World ))))
--------------------------------------------------------------------------------
Junior programmers
# Include <stdio. h>
Void main (void)
{
Char * message [] = {"Hello", "World "};
Int I;
For (I = 0; I <2; ++ I)
Printf ("% s", message);
Printf ("/N ");
}
--------------------------------------------------------------------------------
Programming
# Include <iostream. h>
# Include <string. h>
Class string
{
PRIVATE:
Int size;
Char * PTR;
Public:
String (): size (0), PTR (New char ('/0 ')){}
String (const string & S): size (S. Size)
{
PTR = new char [size + 1];
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 [size + 1];
Strcpy (ptr, chrs );
}
Return (* this );
}
Int main ()
{
String str;
Str = "Hello World ";
Cout <str <end
Return (0 );
}
--------------------------------------------------------------------------------
Programming Skills
[
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 (<partition T. 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 _ stdcall CHello: PrintSz (LPWSTR pwszString)
{
Printf ("% ws/n", 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,
0 xCFEE,
0x101A,
{0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20}
};
UUID LIBID_CHelloLib = {/* 2573F890-CFEE-101A-9A9F-00AA00342820 */
0x2573F890,
0 xCFEE,
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 []
){
HRESULT hRslt;
IHello * pHello;
ULONG ulCnt;
IMoniker * pmk;
WCHAR wcsT [_ MAX_PATH];
WCHAR wcsPath [2 * _ MAX_PATH];
// Get object path
WcsPath [0] = '/0 ';
WcsT [0] = '/0 ';
If (argc> 1 ){
Mbstowcs (wcsPath, argv [1], strlen (argv [1]) + 1 );
Wcsupr (wcsPath );
}
Else {
Fprintf (stderr, "Object path must be specified/n ");
Return (1 );
}
// Get print string
If (argc> 2)
Mbstowcs (wcsT, argv [2], strlen (argv [2]) + 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 );
}
--------------------------------------------------------------------------------
Hacker Initial Stage
#! /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;
--------------------------------------------------------------------------------
Successful hacker
# Include <stdio. h>
# Define s "Hello, world/N"
Main () {exit (printf (S) = strlen (s )? 0: 1 );}
--------------------------------------------------------------------------------
Hacker
% CC-o a. out ~ /Src/MISC/HW. c
% A. Out
--------------------------------------------------------------------------------
Hacker prawns
% Cat
Hello, world.
^ D
--------------------------------------------------------------------------------
Junior Manager
10 print "Hello World"
20 end
--------------------------------------------------------------------------------
Intermediate Manager
Mail-s "Hello, world." Bob @ B12
Bob, cocould you please write me a program that prints "Hello, world ."?
I need it by tomorrow.
^ D
--------------------------------------------------------------------------------
Senior Manager
% Zmail Jim
I need a "Hello, world." program by this afternoon.
--------------------------------------------------------------------------------
CEO
% Letter
Letter: Command not found.
% Mail
To: ^ x ^ f ^ C
% Help mail
Help: Command not found.
% Damn!
! : Event unrecognized
% Logout
--------------------------------------------------------------------------------