选择显示字体大小

程序员的进化--从学生到首席执行官


   /*-------------------------------------------

程序员的进化--从学生到首席执行官

翻译 2002 王咏刚 http://www.contextfree.net/
转译自 omri's computer humor page
http://www.cs.bgu.ac.il/~omri/humor/
-------------------------------------------*/


--------------------------------------------------------------------------------
中学阶段

10 print "hello world"
20 end
--------------------------------------------------------------------------------
大学一年级

program hello(input, output)
begin
writeln('hello world')
end.
--------------------------------------------------------------------------------
大学高年级

(defun hello
(print
(cons 'hello (list 'world))))
--------------------------------------------------------------------------------
初级程序员

#include
void main(void)
{
char *message[] = {"hello ", "world"};
int i;

for(i = 0; i < 2; ++i)
printf(&quot;%s&quot;, message[i]);
printf(&quot;\n&quot;);
}
--------------------------------------------------------------------------------
编程老鸟

#include
#include

class string
{
private:
int size;
char *ptr;

public:
string() : size(0), ptr(new char(&#39;{content}&#39;)) {}

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 = &quot;hello world&quot;;
cout << str << end

return(0);
}
--------------------------------------------------------------------------------
编程高手

[
uuid(2573f8f4-cfee-101a-9a9f-00aa00342820)
]
library lhello
{
// bring in the master library
importlib(&quot;actimp.tlb&quot;);
importlib(&quot;actexp.tlb&quot;);

// bring in my interfaces
#include &quot;pshlo.idl&quot;

[
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(&quot;pshlo.h&quot;);
importheader(&quot;shlo.hxx&quot;);
importheader(&quot;mycls.hxx&quot;);

// needed typelibs
importlib(&quot;actimp.tlb&quot;);
importlib(&quot;actexp.tlb&quot;);
importlib(&quot;thlo.tlb&quot;);

[
uuid(2573f891-cfee-101a-9a9f-00aa00342820),
aggregatable
]
coclass chello
{
cotype thello;
};
};

#include &quot;ipfix.hxx&quot;

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 &quot;thlo.h&quot;
#include &quot;pshlo.h&quot;
#include &quot;shlo.hxx&quot;
#include &quot;mycls.hxx&quot;

int chello::cobjref = 0;

chello::chello(iunknown *punk) : chellobase(punk)
{
cobjref++;
return;
}

hresult __stdcall chello::printsz(lpwstr pwszstring)
{
printf(&quot;%ws\n&quot;, 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 &quot;pshlo.h&quot;
#include &quot;shlo.hxx&quot;
#include &quot;mycls.hxx&quot;

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
#include
#include
#include
#include
#include &quot;pshlo.h&quot;
#include &quot;shlo.hxx&quot;
#include &quot;clsid.h&quot;

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] = &#39;{content}&#39;;
wcst[0] = &#39;{content}&#39;;
if( argc > 1) {
mbstowcs(wcspath, argv[1], strlen(argv[1]) + 1);
wcsupr(wcspath);
}
else {
fprintf(stderr, &quot;object path must be specified\n&quot;);
return(1);
}

// get print string
if(argc > 2)
mbstowcs(wcst, argv[2], strlen(argv[2]) + 1);
else
wcscpy(wcst, l&quot;hello world&quot;);

printf(&quot;linking to object %ws\n&quot;, wcspath);
printf(&quot;text string %ws\n&quot;, 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(&quot;failure to connect, status: %lx&quot;, hrslt);

// tell ole we are going away.
couninitialize();
}

return(0);
}
--------------------------------------------------------------------------------
黑客初阶

#!/usr/local/bin/perl
&#36;msg=&quot;hello, world.\n&quot;;
if (&#36;#argv >= 0) {
while(defined(&#36;arg=shift(@argv))) {
&#36;outfilename = &#36;arg;
open(file, &quot;>&quot; . &#36;outfilename) die &quot;can&#39;t write &#36;arg: &#36;!\n&quot;;
print (file &#36;msg);
close(file) die &quot;can&#39;t close &#36;arg: &#36;!\n&quot;;
}
} else {
print (&#36;msg);
}
1;
--------------------------------------------------------------------------------
黑客有成

#include
#define s &quot;hello, world\n&quot;
main(){exit(printf(s) == strlen(s) ? 0 : 1);}
--------------------------------------------------------------------------------
黑客高手

% cc -o a.out ~/src/misc/hw/hw.c
% a.out
--------------------------------------------------------------------------------
黑客大虾

% cat
hello, world.
^d
--------------------------------------------------------------------------------
初级经理

10 print &quot;hello world&quot;
20 end
--------------------------------------------------------------------------------
中级经理

mail -s &quot;hello, world.&quot; bob@b12
bob, could you please write me a program that prints &quot;hello, world.&quot;?
i need it by tomorrow.
^d
--------------------------------------------------------------------------------
高级经理

% zmail jim
i need a &quot;hello, world.&quot; program by this afternoon.
--------------------------------------------------------------------------------
首席执行官

% letter
letter: command not found.
% mail
to: ^x ^f ^c
% help mail
help: command not found.
% damn!
!: event unrecognized
% logout
--------------------------------------------------------------------------------


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons