Task : write a program that will display "HELLO WORLD" on the screen.
College :
10 PRINT "HELLO WORLD"
20 END
University 1st grade :
program HELLO(input, output)
begin
writeln('HELLO WORLD')
end.
University 2nd grade :
(defun HELLO
(print
(cons HELLO (list 'WORLD))))
Just graduated :
#include [stdio.h]
void main(void)
{
char *message[] = {"HELLO ", "WORLD"};
int j;
for(j = 0; j [ 2; ++j)
Printf("%s", message[j]);
printf("\n"😉;
}
Experimented professionnal :
#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 = "HELLO WORLD";
cout [[ str [[ endl;
return(0);
}
Manager :
mail -s "HELLO, WORLD." bob@b12
Henry, could you write for me a message that displays "HELLO,
WORLD." on the screen ?
I need it for tomorrow.
^D
Chairman :
% letter
letter: Command not found.
% mail
To: ^X ^F ^C
% help mail
help: Command not found.
% damn!
!: Event unrecognized
% logout
[edit]no smilies in C++ !
College :
10 PRINT "HELLO WORLD"
20 END
University 1st grade :
program HELLO(input, output)
begin
writeln('HELLO WORLD')
end.
University 2nd grade :
(defun HELLO
(cons HELLO (list 'WORLD))))
Just graduated :
#include [stdio.h]
void main(void)
{
char *message[] = {"HELLO ", "WORLD"};
int j;
for(j = 0; j [ 2; ++j)
Printf("%s", message[j]);
printf("\n"😉;
}
Experimented professionnal :
#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 = "HELLO WORLD";
cout [[ str [[ endl;
return(0);
}
Manager :
mail -s "HELLO, WORLD." bob@b12
Henry, could you write for me a message that displays "HELLO,
WORLD." on the screen ?
I need it for tomorrow.
^D
Chairman :
% letter
letter: Command not found.
To: ^X ^F ^C
% help mail
help: Command not found.
% damn!
!: Event unrecognized
% logout
[edit]no smilies in C++ !