Programmer's evolution - from students to CEO
From: http://www.contextFree.Net/wangyg/d/proghumor/001.html
-------------------------------------------------- ------------------------------ Middle School stage
10 Print "Hello World" 20 End -------------------------------------------------------------------------------------------------------------------- --------------------------------------College freshman
Program Hello (Input, Output) Begin Writeln ('Hello World') End. --------------------------------- ----------------------------------------------- University high grade
(Defun Hello))) ------------------------------------------------- ---------------------------------------------- Junior programmer
#include
For (i = 0; i <2; i) Printf ("% s", message [i]); printf ("/ n");} -------------- -------------------------------------------------- ---------------- Programming old bird
#include
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]; struct (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 master
[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 (
// NEEDED TYPELIBS IMPORTLIB ("Actimp.tlb"); importlib ("actexp.tlb"); importlib ("thro.tlb");
[UUID (2573F891-CFEE-101A-9A9F-00Aa00342820), aggregatable] coclass chello {cotype thello;};}; # }el};
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
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) {
//hen the object count goes to zero, stop the server cobjref -; if (cobjref == 0) PulseEvent (hEvent);
Return;}
#include
Handle HEVENT;
INT _CDECL Main (int Argc, char * argv []) {ulong ulref; dword dwregistration; cheloccf * 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
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 first
#! / usr / local / bin / perl $ msg = "Hello, World./N"; if ($ # argv> = 0) {while ($ arg = shift (@argv))) {$ outfilename = $ Arg; Open (File, ">" || DIE "Can't Write $ Arg: $! / N"; Print (file $ msg); Close (file) || Die "CAN't Close $ arg: $! / n ";}} else {print ($ msg);} 1; ---------------------------- -------------------------------------------------- - hacker is included in #include
% cc -o a.out ~ / src / misc / hw / hw.c% a.out ---------------------------- -------------------------------------------------- Hacker prawn
% Cat Hello, World. ^ D -------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------- Junior manager
10 Print "Hello World" 20 End -------------------------------------------------------------------------------------------------------------------- -------------------------------------- Intermediate manager
Mail -s "Hello, World." Bob @ b12 bob, could 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