1. .
10 PRINT "HELLO WORLD"
20 END
2. .
program Hello(input,output)
begin
writeln('Hello World')
end.
3. .
(defun hello
(print
(cons' Hello (list 'World))))
4. .
#include
void main(void)
{
char *message[] = {"Hello ","World"};
int i;
for(i = 0; i < 2; ++i)
printf("%s", message[i]);
printf("\n");
}
5. .
#include
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 tring &s)
{
return(stream << s.ptr);
}
string &string::operator = (const char *chrs)
{
if(this != &chr)
{
delete [] ptr;
size = strlen(chrs);
ptr = new char[size + 1];
strcpy(ptr, chr);
}
return(*this);
}
int main()
{
string str;
str = "Hello World";
cout << str << endl;
return(0);
}
6. .
#include
main()
{ char *tmp;
int i=0;
/* */
tmp = (char *)malloc(1024*sizeof(char));
while (tmp[i]="Hello World"[i++]);
/*, */
i = (int)tmp[8];
tmp[8] = tmp[9];
tmp[9] = (char)i;
printf("%s\n",tmp);
}
7. H .
#!/usr/local/bin/perl
$msg="Hello, World.\n";
if ($#ARGV >= 0)
{
while(defined($arg=shift(@ARGV)))
{
$outfilename = $arg;
open(FILE, ">" . $outfile name) || die "Can't close $arg:$!\n";
}
} else {
print($msg);
}
1;
8. .
#include
#define S "Hello, World\n"
main()
{exit(printf(S)==strlen(S)?0:1);}
9. .
% cc -o a.out
~/src/misc/hw/hw.c
% a.out
10. -.
% cat
Hello, World.
^D
11. .
10 PRINT "HELLO WORLD"
20 END
12. .
% mail -s "Hello, World."
bob@b12
, "Hello, World."?
.
^D
13. .
% zmail jim
"Hello, World.", !
14. .
% letter
letter: Command not found.
% mail
To: ^X ^F ^C
% help mail
help: Command not found.
% !
!: Event unrecognized.
% logout