[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
The evolution of the famous HELLO.C in the programer's life
Cha`o ca? la`ng, nha^'t la`ca'c ba'c CS,
Gu+?i ca'c ba'c va`i variation cu?a program HELLO.C no^?i tie^'ng ma`
cha('c ai cu~ng bie^'t
dde^? ca'c ba'c ddo.c gia?i tri'
Son,=20
The evolution of the famous HELLO.C in the programer's life
------------------------------------------------------------------------
--------
Secondary School
10 PRINT "HELLO WORLD"
20 END
1st year in the university
program Hello(input, output)
begin
writeln('Hello World')
end.
Last year in the university
(defun hello
(print
(cons 'Hello (list 'World))))
Beginner professional programer
#include <stdio.h>
void main(void)
{ char *message[] =3D {"Hello ", "World"};
int i;
for(i =3D 0; i< 2; ++i)
printf("%s", message[i]);
printf("\n");
}
Professional programer
#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 =3D new char[size + 1];
strcpy(ptr, s.ptr);
}
~string()
{
delete [] ptr;
}
friend ostream &operator <<(ostream &, const string &);
string &operator=3D(const char *);
};
ostream &operator<<(ostream &stream, const string &s)
{
return(stream << s.ptr);
}
string &string::operator=3D(const char *chrs)
{
if (this !=3D &chrs)
{
delete [] ptr;
size =3D strlen(chrs);
ptr =3D new char[size + 1];
strcpy(ptr, chrs);
}
return(*this);
}
int main()
{
string str;
str =3D "Hello World";
cout << str << endl;
return(0);
}
Very very professional programer
[
uuid(2573F8F4-CFEE-101A-9A9F-00AA00342820)
]
library LHello
{
// 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 THello
{
interface IHello;
interface IPersistFile;
};
};
[
exe,
uuid(2573F890-CFEE-101A-9A9F-00AA00342820)
]
module CHelloLib
{
// some code related header files
importheader(
Beginner hacker
#!/usr/local/bin/perl
$msg=3D"Hello, world.\n";
if ($#ARGV =3D 0) {
while(defined($arg=3Dshift(@ARGV))) {
$outfilename =3D $arg;
open(FILE, "" . $outfilename) =A6=A6 die "Can't write $arg: =
$!\n";
print (FILE $msg);
close(FILE) =A6=A6 die "Can't close $arg: $!\n";
}
} else {
print ($msg);
}
1;
Experienced hacker
#include
More experienced hacker
% cc -o a.out ~/src/misc/hw/hw.c
% a.out
Profession hacker
% cat
Hello, world.
^D
Newly appointed manager
10 PRINT "HELLO WORLD"
20 END
Middle-level manager
mail -s "Hello, world." bob@b12
Bob, can you write a program for me until tomorrow,
that display "Hello word" on the screen?
Thanks!
^D
Director
% zmail jim
I need a "Hello Word" program today afternoon.
CEO
% letter
letter: Command not found.
% mail To: ^X
^F ^C
% help mail
help: Command not found.
% fuck!
!: Event unrecognized
% logout
--------------------------------------------