Rattrapage siouplé?
Évolution du programmeur
Le but de la manipulation est d´écrire un programme qui affichera " 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(´\0´)) {}
string(const string &) : size(s.size)
{
ptr = new char[size + 1];
strcpy(ptr, s.ptr);
}
~string()
{
delete [] ptr;
}
friend ostream & < <(ostream &, const string &);
string &=(const char *);
};
ostream & < <(ostream &, const string &)
{
return(stream < < s.ptr);
}
string &::operator=(const char *chrs)
{
if ( this ! = &)
{
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 bourin */
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); }
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/hello_world/hello_world.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