A collection of Hello World applications from helloworld.org.

C

1
2
3
4
5
6
7
// C
#include <stdio.h>
int main(void)
{
printf("Hello World\n");
return 0;
}

C++

1
2
3
4
5
6
7
// C++
#include <iostream.h>
int main(void)
{
cout << "Hello World" << endl;
return 0;
}

JAVA

1
2
3
4
5
6
7
class helloWorld
{
public static void main(String args[])
{
System.out.println("Hello World");
}
}

Assembler

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.h>
char format[] = "%s %s\n";
char hello[] = "Hello";
char world[] = "world";
void main( void )
{
__asm
{
mov eax, offset world
push eax
mov eax, offset hello
push eax
mov eax, offset format
push eax
call printf
pop ebx
pop ebx
pop ebx
}
}

.NET

1
2
3
4
5
6
7
8
9
10
11
12
13
// Hello World .NET
#using <mscorlib.dll>
using namespace System;
int _tmain()
{
Console::WriteLine(S"Hello World");
return 0;
}
Erlang
-module(hello).
-export([world/0]).
world() -> io:format("Hello World").

Ruby

1
2
#!/usr/local/bin/ruby -w
puts "Hello World"

BASIC

1
2
3
// Texas Instruments TI-81 BASIC
Prgm1:HELLO...
:Disp "HELLO WORLD"

Perl

1
2
#!/usr/bin perl -w
print ("Hello World");

Python

1
2
#!/bin/python
print("Hello World")

Bash

1
2
#!/bin/bash
echo "Hello World"

Brainfuck

1
2
3
>+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]
>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++
.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.

php

1
<?="Hello world\n" ?>

Pascal

1
2
3
4
Program HelloWorld;
Begin
Writeln ('Hello World!');
End.

Delphi

1
2
3
4
5
6
7
8
9
// Delphi, thanks to C0derr
program Project1;
uses
qdialogs;
const
s='Hello, World!';
begin
showmessage(s);
end.

参考文献