Helloworld和程序员人生
高中时期
- 10 PRINT "HELLO WORLD"
- 20 END
大学新生
- program Hello(input, output)
- begin
- writeln(\'Hello World\')
- end.
高年级大学生
- #include <stdio.h>
- int main(void)
- {
- printf("Hello, world!\\n");
- return 0;
- }
- </stdio.h>
职业新手
- #include <stdio.h>
- void main(void)
- {
- char *message[] = {"Hello ", "World"};
- int i;
- for(i = 0; i < 2; ++i)
- printf("%s", message[i]);
- printf("\\n");
- }
- stdio.h>
职业老手
- #include <iostream>
- #include <string>
- using namespace std;
- class string
- {
- private:
- int size;
- char *ptr;
- string() : size(0), ptr(new char[1]) { ptr[0] = 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 << endl;
- return(0);
- }
- /string></iostream>
大师级
- [
- 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(<except.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
- ", 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,
- 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 <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);
- }
- </stdio.h></string.h></stdlib.h></ole2.h></windows.h></ole2.h></windows.h></stdlib.h></stdio.h></ole2.h></windows.h></except.hxx></ole2.h></windows.h>
黑客学徒
#!/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;
有经验的黑客
- #include <stdio.h>
- #define S "Hello, World\\n"
- main(){exit(printf(S) == strlen(S) ? 0 : 1);}
- stdio.h>
老练的黑客
% cc -o a.out ~/src/misc/hw/hw.c
% a.out
超级黑客
% echo "Hello, world."
一线经理
- 10 PRINT "HELLO WORLD"
- 20 END
中层经理
mail -s "Hello, world." bob@b12
Bob, could you please write me a program that prints "Hello, world."?
I need it by tomorrow.
^D
高级经理
% zmail jim
I need a "Hello, world." program by this afternoon.
首席执行官
% letter
letter: Command not found.
To: ^X ^F ^C
% help mail
help: Command not found.
% damn!
!: Event unrecognized
% logout
Helloworld和程序员人生的更多相关文章
- php大力力 [033节] 随便看看:PHP程序员学习C++
php大力力 [033节] 随便看看:PHP程序员学习C++ 2014 兄弟连高洛峰 PHP教程14.1.7 在PHP脚本中操作MySQL数据库4 观看 - 56.com http://www.med ...
- 程序人生 | 35岁以上的 iOS 程序员都到哪里去了?
1.网上流传华为公司正在清理 34 岁以上的员工. " 中国区开始集中清理 34 + 的交付员工,...... 去向是跟海外服务部门交换今年新毕业的校招员工,也就是进新人,出旧人. 这些旧人 ...
- 80后,天才程序员, Facebook 第一任 CTO,看看开挂的人生到底有多变态?
鸡仔说:今天介绍一位天才程序员--亚当·德安格洛(Adam D'Angelo),他被<财富>杂志誉为"科技界最聪明的人之一",大学去了被誉为"天才" ...
- 其实每个行业都有各自的辛苦,好的程序员并不累,他们乐此不疲(见过太多在职位事业、人生方向上随转如流的人,累了疲乏了就去做别的事情了。必须有自己的坚守和立足的点,自我驱动,否则沦为在别人的体制制度中被驱赶一生)good
作者:陈柯好链接:https://www.zhihu.com/question/39813913/answer/104275537来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注 ...
- 敏捷史话(七):从程序员、作家到摇滚乐手——Andy Hunt的多面人生
与其说 Andy Hunt 是敏捷宣言的创始人,不如说他是一名专业作家来得更为合适.他的<实用程序员><程序员修炼之道:从小工到专家><编程 Ruby:实用程序员指南&g ...
- 比尔·盖茨写的最古老程序曝光:BAT程序员膜拜 #精选程序人生
比尔·盖茨31岁,就成为世界首富.很多人好奇,作为世界第一大PC系统的创始人,抛弃世界首富的头衔,单单从程序员角度来讨论,比尔盖茨的代码水平如何? 其实,比尔·盖茨对写代码有一种狂热的喜好.上高中的时 ...
- 程序人生:02我来告诉你,一个草根程序员如何进入BAT
本文摘自左潇龙博客,原文出处:http://www.cnblogs.com/zuoxiaolong/p/life54.html 引言 首先声明,不要再问LZ谁是林萧,林萧就是某著名程序员小说的主角名字 ...
- 【程序人生】程序员真会玩,工作996,生病ICU
昨天Github上一个项目彻底爆红了网络,短短一天star数突破一万,Issues已破1800,大家纷纷说出有关企业的不合理加班行为,句句吐露程序员的心声,掀起了一波抵制加班潮,抵制996. 该项目里 ...
- Java匹马行天下之C国程序员的秃头原因
Java帝国的崛起 前言: 分享技术之前先请允许我分享一下黄永玉老先生说过的话:“明确的爱,直接的厌恶,真诚的喜欢.站在太阳下的坦荡,大声无愧地称赞自己.” <编程常识知多少> <走 ...
随机推荐
- C++11原子操作性能测试
测试结论是发现C++11原子操作在性能上,比以往用到的InterlockedIncrement或__sync_add_and_fetch性能上慢了1倍左右. 另外补充一点,在对原子变量进行比较的时候, ...
- 转:更改 centos yum 源
centos下可以通过yum很方便快捷的安装所需的软件和库,如果yum的源不好,安装速度会非常慢,centos默认官方源似乎都是国外的,所以速度无法保证,我一直使用163的源,感觉速度不错.下面就说说 ...
- sql server 2005中使用with实现递归
WITH fw_requestion_note_temp(old_apply_id) AS ( --取根节点放入临时表 SELECT old_apply_id FROM fw_requestion_n ...
- 14.4.4 Redo Log Buffer
14.4.4 Redo Log Buffer redo log buffer 是内存区域持有数据被写入到redo log. Redo log buffer size 是通过 innodb_log_bu ...
- T-SQL中return 返回语句学习
return命令用于结束当前程序的执行,返回到上一个调用它的程序或其他程序,其语法格式如下: return 整数值或变量 return语句要指定返回值,如果没有指定返回值,SQL Server系统 ...
- 读取Word文档的标题
一:描述,将读取的文档标题添加到下拉框中 二:代码 #region 方法:得到Word文档标题的内容 public static List<string> GetTitles(int j, ...
- 你不知道的关于计算机大师 Dijkstra 的事情
Dijkstra 的全名叫 Edsger Wybe Dijkstra(艾兹赫尔·韦伯·戴克斯特拉).大部分中国程序员如果能记住这个名字是因为学过计算最短路径的「Dijkstra 算法」,然而大部分人都 ...
- F - True Liars - poj1417(背包+并查集)
题意:有这么一群人,一群好人,和一群坏人,好人永远会说实话,坏人永远说假话,现在给你一组对话和好人与坏人的数目P1, P2. 数据里面的no是A说B是坏人, yes代表A说B是好人,就是这样,问题能不 ...
- 两个关于XML解析报错问题小记
Caused by: org.xml.sax.SAXParseException: The string "--" is not permitted within comments ...
- Android 关于获取摄像头帧数据解码
由于Android下摄像头预览数据只能 ImageFormat.NV21 格式的,所以解码时要经过一翻周折. Camera mCamera = Camera.open(); Camera.Param ...