/*-------------------------------------------
ProgramEmployee 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
Void main (void)
{
Char * message [] = {"hello", "world "};
Int I;
For (I = 0; I <2; ++ I)
Printf ("% s", message [I]);
Printf ("\ n ");
}
--------------------------------------------------------------------------------
Programming
# Include
# Include
Class string
{
PRIVATE:
Int size;
Char * PTR;
Public:
String (): size (0), PTR (New char (''{content }'')){}
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 ();
Importheader ();
Importheader ();
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
# Include
# Include
# Include
# 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
# Include
# 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
# Include
# Include
# Include
# Include
# 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] = ''{content }'';
WCST [0] = ''{content }'';
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
# 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
--------------------------------------------------------------------------------