男子生徒:
10「HELLO WORLD」の印刷
20終了
新入生:
プログラムHello(入力、出力)
始める
writeln(「Hello World」)
終わり。
先輩:
(defunこんにちは
(印刷
(cons 'Hello(list' World)))))
新しいスペシャリスト:
#include <stdio.h>
void main(ボイド)
{
char * message [] = {"Hello"、 "World"};
int i;
for(i = 0; i <2; ++ i)
printf( "%s"、メッセージ[i]);
printf( "\ n");
}
経験豊富なスペシャリスト:
#include <iostream.h>
#include <string.h>
クラス文字列
{
プライベート:
intサイズ;
char * ptr;
公開:
文字列():サイズ(0)、ptr(新しい文字( '\ 0')){}
文字列(定数文字列&s):サイズ(s.size)
{
ptr = new char [サイズ+ 1];
strcpy(ptr、s.ptr);
}
〜文字列()
{
[] ptrを削除します。
}
friend ostream&operator <<(ostream&、const string&);
文字列&演算子=(const char *);
};
ostream&operator <<(ostream&stream、const string&s)
{
return(stream << s.ptr);
}
文字列と文字列::演算子=(const char * chrs)
{
if(this!=&chrs)
{
[] ptrを削除します。
サイズ= strlen(chrs);
ptr = new char [サイズ+ 1];
strcpy(ptr、chrs);
}
return(* this);
}
int main()
{
文字列str;
str = "Hello World";
cout << str << endl;
return(0);
}
経験豊富なプログラマー:
[
uuid(2573F8F4-CFEE-101A-9A9F-00AA00342820)
]
ライブラリーLHello
{
//マスターライブラリを取り込みます
importlib( "actimp.tlb");
importlib( "actexp.tlb");
importlib( "actexp.tlb");
//インターフェースを持ち込みます
#include "pshlo.idl"
[
uuid(2573F8F5-CFEE-101A-9A9F-00AA00342820)
]
コタイプTHello
{
インターフェイスIHello;
インターフェースIPersistFile;
};
};
[
exe
uuid(2573F890-CFEE-101A-9A9F-00AA00342820)
]
モジュールCHelloLib
{
//事前に関連するヘッダーファイル
importheader();
importheader();
importheader();
importheader( "pshlo.h");
importheader( "shlo.hxx");
importheader( "mycls.hxx");
//必要なtypelib
importlib( "actimp.tlb");
importlib( "actexp.tlb");
importlib( "thlo.tlb");
[
uuid(2573F891-CFEE-101A-9A9F-00AA00342820)、
集約可能
]
コクラスチェロ
{
コタイプTHello;
};
};
#include "ipfix.hxx"
extern HANDLE hEvent;
クラスCHello:パブリックCHelloBase
{
公開:
IPFIX(CLSID_CHello);
チェロ(IUnknown * pUnk);
チェロ(IUnknown * pUnk);
〜チェロ();
HRESULT __stdcall PrintSz(LPWSTR pwszString);
プライベート:
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 ++;
帰る
}
HRESULT __stdcallチェロ:: PrintSz(LPWSTR pwszString)
{
printf( "%ws \ n"、pwszString);
return(ResultFromSpre(S_OK));
}
CHello ::〜CHello(void)
{
//オブジェクト数がゼロになったら、サーバーを停止します
cObjRef--;
if(cObjRef == 0)
PulseEvent(hEvent);
帰る
}
#include <windows.h>
#include <ole2.h>
#include "pshlo.h"
#include "shlo.hxx"
#include "mycls.hxx"
ハンドルhEvent;
int _cdecl main(
int argc、
char * argv []
){
ULONG ulRef;
DWORD dwRegistration;
CHelloCF * pCF =新しいCHelloCF();
hEvent = CreateEvent(NULL、FALSE、FALSE、NULL);
// OLEライブラリを初期化します
CoInitializeEx(NULL、COINIT_MULTITHREADED);
CoRegisterClassObject(CLSID_CHello、pCF、CLSCTX_LOCAL_SERVER、
REGCLS_MULTIPLEUSE、およびdwRegistration);
//停止するイベントを待ちます
WaitForSingleObject(hEvent、INFINITE);
//クラスオブジェクトを取り消して解放します
CoRevokeClassObject(dwRegistration);
ulRef = pCF->リリース();
// OLEがなくなることを伝えます。
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 []
char * argv []
){
HRESULT hRslt;
IHello * pHello;
ULONG ulCnt;
IMoniker * pmk;
WCHAR wcsT [_MAX_PATH];
WCHAR wcsPath [2 * _MAX_PATH];
//オブジェクトパスを取得
wcsPath [0] = '\ 0';
wcsT [0] = '\ 0';
if(argc> 1){
mbstowcs(wcsPath、argv [1]、strlen(argv [1])+ 1);
wcsupr(wcsPath);
}
その他{
fprintf(stderr、「オブジェクトパスを指定する必要があります\ n」);
return(1);
}
//印刷文字列を取得します
if(argc> 2)
mbstowcs(wcsT、argv [2]、strlen(argv [2])+ 1);
他に
wcscpy(wcsT、L "Hello World");
printf( "object%ws \ nへのリンク"、wcsPath);
printf( "テキスト文字列%ws \ n"、wcsT);
// OLEライブラリを初期化します
hRslt = CoInitializeEx(NULL、COINIT_MULTITHREADED);
if(SUCCEEDED(hRslt)){
hRslt = CreateFileMoniker(wcsPath、&pmk);
if(成功(hRslt))
hRslt = BindMoniker(pmk、0、IID_IHello、(void **)&pHello);
if(SUCCEEDED(hRslt)){
//文字列を出力します
pHello-> PrintSz(wcsT);
睡眠(2000);
ulCnt = pHello->リリース();
}
他に
printf(「接続失敗、ステータス:%lx」、hRslt);
// OLEがなくなることを伝えます。
CoUninitialize();
}
return(0);
return(0);
}
初心者ハッカー:
#!/ usr / local / bin / perl
$ msg = "Hello、world。\ n";
if($#ARGV> = 0){
while(defined($ arg = shift(@ARGV))){
$ outfilename = $ arg;
オープン(FILE、「>」。$ outfilename)|| die "$ argを書き込めない:
$!\ n ";
print(FILE $ msg);
閉じる(FILE)|| die "$ argを閉じることができません:$!\ n";
}
} else {
print($ msg);
}
1;
経験豊富なハッカー:
#include
#define S "Hello、World \ n"
main(){exit(printf(S)== strlen(S)?0:1);}
経験豊富なハッカー:
%cc -o a.out〜/ src / misc / hw / hw.c
%a.out
ハッカー、すべてのハッカー-ハッカー:
%猫
ハローワールド。
^ D
新しいリーダー:
10「HELLO WORLD」の印刷
20終了
ミドルマネージャー:
mail -s「Hello、world。」bob @ b12
Kolyan、「Hello、world。」を表示するプログラムの作成を手伝ってください。
明日までに完了する必要があります。
^ D
シニアリーダー:
%zmail Kolyan
「こんにちは、世界」が必要です。夕食に。
法人長:
%文字
letter:コマンドが見つかりません。
%メール
宛先:^ X ^ F ^ C
ヘルプメールの割合
help:コマンドが見つかりません。
%地獄!
!:イベントが認識されません
ログアウト率
英語版はここにありました 。