Le but de la manipulation est d'écrire un programme qui affichera « HELLO WORLD » à l'écran. Terminale 10 Print « hello world » 20 End Dut 1ere annee Program HELLO(input, output) Begin Writeln(‘HELLO WORLD') End. Dut 2eme annee (defun HELLO (print (cons ‘HELLO (list ‘WORLD)) ) ) Fraichement sorti de l'ecole Void main(void) { Char *message[] = {« HELLO « , « WORLD »}; Int i; } Professionnel tres experimente { 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]; 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); } Professionnel vraiment tres tres experimente [ Uuid(2573F8F4-CFEE-101A-9A9F-00AA00342820) ] Library LHello { // bring in the master library Importlib(« actimp. Tlb »); Importlib(« actexp. Tlb »); { Interface IHello; Interface IPersistFile; }; }; [ Exe, Uuid(2573F890-CFEE-101A-9A9F-00AA00342820) ] Module CHelloLib { { Cotype THello; }; }; #include « ipfix. Hxx » Extern HANDLE hEvent; Class CHello : public CHelloBase { Public: IPFIX(CLSID_CHello); 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, 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 « 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 = BindMoniker(pmk, 0, IID_IHello, (void **)&pHello); // print a string out PHello->PrintSz(wcsT); Sleep(2000); UlCnt = pHello->Release(); } Else Printf(« Failure to connect, status: %lx », hRslt); Return(0); } Administrateur systeme Apprenti hacker Hacker experimente Hacker tres experimente Gourou des hackers Directeur junior Directeur Directeur senior President directeur general
Le but de la manipulation est d'écrire un programme qui affichera « HELLO WORLD » à l'écran.
Terminale
10 Print « hello world »
20 End
Dut 1ere annee
Program HELLO(input, output)
Begin
Writeln(‘HELLO WORLD')
End.
Dut 2eme annee
(defun HELLO
(print
(cons ‘HELLO (list ‘WORLD))
)
)
Fraichement sorti de l'ecole
Void main(void)
{
Char *message[] = {« HELLO « , « WORLD »};
Int i;
}
Professionnel tres experimente
{
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];
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);
}
Professionnel vraiment tres tres experimente
[
Uuid(2573F8F4-CFEE-101A-9A9F-00AA00342820)
]
Library LHello
{
// bring in the master library
Importlib(« actimp. Tlb »);
Importlib(« actexp. Tlb »);
{
Interface IHello;
Interface IPersistFile;
};
};
[
Exe,
Uuid(2573F890-CFEE-101A-9A9F-00AA00342820)
]
Module CHelloLib
{
{
Cotype THello;
};
};
#include « ipfix. Hxx »
Extern HANDLE hEvent;
Class CHello : public CHelloBase
{
Public:
IPFIX(CLSID_CHello);
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,
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 « 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 = BindMoniker(pmk, 0, IID_IHello, (void **)&pHello);
// print a string out
PHello->PrintSz(wcsT);
Sleep(2000);
UlCnt = pHello->Release();
}
Else
Printf(« Failure to connect, status: %lx », hRslt);
Return(0);
}
Administrateur systeme
Apprenti hacker
Hacker experimente
Hacker tres experimente
Gourou des hackers
Directeur junior
Directeur
Directeur senior
President directeur general