IPB

Bienvenue invité ( Connexion | Inscription )

[ En ligne ] · Standard · Linéaire+

> Et Vous De Quelle Catégorie êtes-vous ?, Rions un peu avec le C

chon
post 20/11/2002 22:15
Message #1


Le Daydreamer
****

Groupe : Modérateurs
Messages : 1,726
Inscrit le : 16/05/2002 23:00
Lieu : quelque part dans les nuages ...
Membre no. 13



Sans le faire vraiment exprès, je suis tombé sur un petit truc bien débile au boulot aujourd'hui.

En gros cela présente les différentes manières d'afficher (le célèbre) Hello World, suivant votre rang dans une hiérarchie.

Bon c'est bien débile, cela doit être connu de certains, mais bon je le mets pour les autres.

(Note : il faut quand même si connaître un peu en prog :])

L'évolution d'un programmeur, ou comment afficher "Hello World" à l'écran

/****************************************************/

Terminale
10 PRINT "HELLO WORLD"
20 END

DUT 1ère année
program HELLO(input, output)
begin
writeln('HELLO WORLD')
end.

DUT 2ème année
(defun HELLO
(print
(cons HELLO (list 'WORLD))))

Fraîchement sorti de l'école
#include [stdio.h]
void main(void)
{
char *message[] = {"HELLO ", "WORLD"};
int i;
for(i = 0; i [ 2; ++i)
Printf("%s", message[i]);
printf("\n");
}

Professionnel très expérimenté
#include [iostream.h]
#include [string.h]
class string
{
private:
int size;
char *ptr;
public:
string() : size(0), ptr(new char('<!--POST BOX-->')) {}
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);
}

Administrateur Système
#include (stdio.h)
main()
{
char *tmp;
int i=0;
/* on y va bourrin */
tmp=(char *)malloc(1024*sizeof(char));
while (tmp[i]="HELLO WORLD"[i++]);
/* Ooopps y'a une infusion ! */
i=(int)tmp[8];
tmp[8]=tmp[9];
tmp[9]=(char)i;
printf("%s\n",tmp);
}

Apprenti Hacker
#!/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;

Hacker expérimenté
#include [stdio.h]
#define S "HELLO, WORLD\n"
main(){exit(printf(S) == strlen(S) ? 0 : 1);}

Hacker très expérimenté
% cc -o a.out ~/src/misc/bv/bv.c
% a.out

Gourou des Hackers
% cat
HELLO, WORLD.
^D

Directeur junior
10 PRINT "HELLO WORLD"
20 END

Directeur
mail -s "HELLO, WORLD." bob@b12
Henri, pourrais-tu m'écrire un programme qui écrit "HELLO,
WORLD." À l'écran?
J'en ai besoin pour demain.
^D

Directeur sénior
% zmail Jean
J'ai besoin d'un programme "HELLO, WORLD." Pour cette après-midi.

Président Directeur Général
% letter
letter: Command not found.
% mail
To: ^X ^F ^C
% help mail
help: Command not found.
% damn!
!: Event unrecognized
% logout


/****************************************************/

Pour ma part, j'avoue me sentir très proche de Administrateur Système et/ou de Hacker expérimenté (tout dépend de ma finesse d'ésprit pour coder tongue.gif).



--------------------
There is no emotion, there is peace, There is no ignorance, there is knowledge, There is no passion, there is serenity
There is no chaos, there is harmony, There is no death, there is the force

User is offlineProfile CardPM
Go to the top of the page
+Quote Post
 
Reply to this topicStart new topicStart Poll
Réponse(s)
Gfx
post 21/11/2002 18:35
Message #2


Goule
****

Groupe : Membres
Messages : 980
Inscrit le : 01/08/2002 23:00
Lieu : Lyon
Membre no. 106



En ce moment je serais plutôt dans le tyle "Développeur Corporate", qui ressemble en gros au développeur expérimenté. En gros :
CODE

   Call call = new Call();

   //This service uses standard SOAP encoding
   String encodingStyleURI = Constants.NS_URI_SOAP_ENC;
   call.setEncodingStyleURI(encodingStyleURI);

   //Set the target URI
   call.setTargetObjectURI("urn:hello-world");

   //Set the method name to invoke
   call.setMethodName("helloWorld");

   //Create the parameter objects
   Vector params = new Vector();
   //params.addElement(new Parameter("fr", String.class, item, null));

   //Set the parameters
   call.setParams (params);

   //Invoke the service
   Response resp = call.invoke(new java.net.URL(m_hostURL), "");

   //Check the response
   if (resp != null)
   {
     if (resp.generatedFault())
     {
       Fault fault = resp.getFault();
       System.out.println ("Call failed due to a SOAP Fault: ");
       System.out.println ("  Fault Code   = " + fault.getFaultCode ());
       System.out.println ("  Fault String = " + fault.getFaultString ());
     } else {
       Parameter result = resp.getReturnValue();
       System.out.println(result.getValue());
     }
   }


Vous l'aurez compris, ce Hello World utilise un Web Service en SOAP-RPC et son utilisation ne nécessite qu'un simple serveur de 70 Mo pour fonctionner :-) Mais bon, au moins y'a du Web, du Service et du XML, donc c'est corporate et ça se vendra. Plus que les vôtres en tout cas tongue.gif

:-)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))


--------------------
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Posts in this topic
chon   Et Vous De Quelle Catégorie êtes-vous ?   20/11/2002 22:15
Ryle   Ben moi ce serait plutôt fraîchement sorti de l...   21/11/2002 8:29
Guepi   ouais pareil que Ryle ... fraîchement sorti de l...   21/11/2002 9:26
PoP   J'aime pas le C.   21/11/2002 9:45
Arsenik_   Moi ca serai plutot : car je suis faignante de...   21/11/2002 10:50
chon   Le truc le plus rigolo, c'est que certaines ch...   21/11/2002 10:50
Sha   Hue moi disons que je suis un amateur évolué ^_...   21/11/2002 18:25
Gfx   En ce moment je serais plutôt dans le tyle ...   21/11/2002 18:35
Gfx   Ah et voilà le Web Service en question (notez qu...   21/11/2002 18:39
Gfx   Qui serait totalement inutile sans son descripteur...   21/11/2002 18:41
chon   Gfx > Looool :lol: J'aurais dû rajouter u...   21/11/2002 19:03
Sha   MDR :wahaha:   21/11/2002 19:42
Ryle   :lol: :lol:   21/11/2002 22:17
Darhf   Tin en fait je suis pire que je le croyais, le web...   21/11/2002 22:51
PoP   MMMMMMMMMMMMMMMMMMMMMMMMDR! Punaize Gfx, t...   22/11/2002 10:13
Gfx   Meuh non, comme je l'ai dit, j'ai juste le...   22/11/2002 16:41
Poischack   au temps de l'amstrad: ? "Hello World"   22/11/2002 20:26
IOEN   moi j'ouvre le bloc note et je tape "hell...   15/12/2002 13:30
Gragt le Cruel   [ Main; print "Hello world^"; ]; ...   15/12/2002 15:50
yaka94   ROFL !! genial !   15/12/2002 18:31
Ghost Line   Clair C fort :) Par contre y'a un truc que je...   15/12/2002 22:21
Gfx   Je vous le fais en J2ME MIDP ?   16/12/2002 22:04
Peter Pan   http://www.smilies.org/basesmilies/malad_DooD.gif   17/12/2002 0:26
irion_d_alcor   malheur , dire que des gens comme ca existent et q...   17/12/2002 9:57
Sha   Un clic est l'entrée du texte dans VB.Net pro...   17/12/2002 10:34
Peter Pan   Sha > tu devrais ajouter le Framework avec ^_^   17/12/2002 12:27
PoP   Gfx>ouais, pourquoi pas!   17/12/2002 14:27


Reply to this topicTopic OptionsStart new topic
1 utilisateur(s) sur ce sujet (1 invité(s) et 0 utilisateur(s) anonyme(s))
0 membre(s) :
 

Version bas débit Nous sommes le : : 13/07/2025 19:55