Accueil Actualités Etude de cas Adhésion Contact

Approche dynamique
 Vocation
 Principes
 Phases
 Applications
Documentation
 V3 en français
 V4
 e-DSDM
 Livrets blancs
 A télécharger
Association
 DSDM et vous
 Adhésion
 Sensibilisation
 Formation
 Certification
Coordonnées

 DSDM France

 6, rue des Deux
 Communes
 94300 Vincennes

 + 33 1 43 28 88 96

 info@dsdmfrance.com

Retour à l'index

Bonjour au monde
Dimanche, 3 Mars 2002, par Ian Stokes

Sujet : Humour

Résumé :

Comment dire "bonjour au monde" en fonction de son expérience informatique.

Corps de l'article :

Lycée :

10 PRINT "BONJOUR AU MONDE"
20 END

Nouvelle arrivée au Collège :

program Bonjour(input, output)
begin
writeln ('Bonjour au monde')
end.

Expérimenté au Collège :

(defun Bonjour
(print
(cons 'Bonjour (list 'au monde))))

Stagiaire :

#include <stdio.h>
void main(void)
{
char *message[] = {"Bonjour ", "au Monde"};
int i;

for(i = 0; i < 2; ++i)
printf("%s", message[i]);
printf("\n");
}

Professionnel confirmé :

#include <iostream.h>
#include <string.h>

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];
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 = "Bonjour au Monde";
cout << str << endl;

return(0);
}

Informaticien confirmé :

[
uuid(2573F8F4-CFEE-101A-9A9F-00AA00342820)
]
library LBonjour
{
// 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 TBonjour
{
interface IBonjour;
interface IPersistFile;
};
};

[
exe,
uuid(2573F890-CFEE-101A-9A9F-00AA00342820)
]
module CBonjourLib
{

// 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 CBonjour
{
cotype TBonjour;
};
};

#include "ipfix.hxx"

extern HANDLE hEvent;

class CBonjour : public CBonjourBase
{
public:
IPFIX(CLSID_CBonjour);

CBonjour(IUnknown *pUnk);
~CBonjour();

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 CBonjour::cObjRef = 0;

CBonjour::CBonjour(IUnknown *pUnk) : CBonjourBase(pUnk)
{
cObjRef++;
return;
}

HRESULT __stdcall CBonjour::PrintSz(LPWSTR pwszString)
{
printf("%ws\n", pwszString);
return(ResultFromScode(S_OK));
}

CBonjour::~CBonjour(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;
CBonjourCF *pCF = new CBonjourCF();

hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);

// Initialize the OLE libraries
CoInitializeEx(NULL, COINIT_MULTITHREADED);

CoRegisterClassObject(CLSID_CBonjour, 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_CBonjour;
extern UUID LIBID_CBonjourLib;

CLSID CLSID_CBonjour = { /* 2573F891-CFEE-101A-9A9F-00AA00342820 */
0x2573F891,
0xCFEE,
0x101A,
{ 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 }
};

UUID LIBID_CBonjourLib = { /* 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;
IBonjour *pBonjour;
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"Bonjour au monde");

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_IBonjour, (void **)&pBonjour);

if(SUCCEEDED(hRslt)) {

// print a string out
pBonjour->PrintSz(wcsT);

Sleep(2000);
ulCnt = pBonjour->Release();
}
else
printf("Failure to connect, status: %lx", hRslt);

// Tell OLE we are going away.
CoUninitialize();
}

return(0);
}

Pirate apprenti :

#!/usr/local/bin/perl
$msg="Bonjour au monde.\n";
if ($#ARGV >= 0) {
while(defined($arg=shift(@ARGV))) {
$outfilename = $arg;
open(FILE, ">" . $outfilename) || die "peut pas écrire $arg: $!\n";
print (FILE $msg);
close(FILE) || die "peut pas fermer $arg: $!\n";
}
} else {
print ($msg);
}
1;

Pirate confirmé :

#include <stdio.h>
#define S "Bonjour au monde\n"
main(){exit(printf(S) == strlen(S) ? 0 : 1);}

Pirate expérimenté :

% cc -o a.out ~/src/misc/hw/hw.c
% a.out

Pirate guru :

% cat
Bonjour au monde.
^D

Nouveau cadre :

10 PRINT "BONJOUR AU MONDE"
20 END

Cadre confirmé :

mail -s "Bonjour au monde." bob@b12
Robert, peux-tu me faire un programme pour imprimer "Bonjour au monde." ?
J’en ai besoin pour demain.
^D

Chef de département :

% zmail jim
J’ai besoin de "Bonjour au monde." avant cet après-midi.

Chef d’entreprise :

% letter
letter: Command not found.
% mail
To: ^X ^F ^C
% help mail
help: Command not found.
% merde !!!
!: Event unrecognized
% logout

Publiez vos commentaires sur cet article
NEWSLETTER
 Abonnement
 Visite des archives
CONSEIL
Evaluez les bénéfices de DSDM pour votre projet
PARTENAIRES
  Bita Center
  Esiee
  Metanaction
  Pilot Systems
 

Haut de page Accueil A propos de DSDM Copyright Crédits Contact
 © 1997-2002 Dynamic Systems Development Method - Réalisation Pilot Systems - Powered by Zope