The "Hello World!" Thread!

we11er

Newbie
Joined
Jan 13, 2004
Messages
1,035
Reaction score
0
Yes, I want to see a simple "Hello World!" program in as many different languages as we can manage. Only one per language though folks - I don't want to see 50 java programs!

I'll start with good ol' C++

Code:
#include <iostream>

int main()
{
    std::cout << "Hello World!" << std::endl;
    return 0;
}

Have fun!
 
[QBASIC]

10 PRINT "Hello World!"

[Visual Basic]

MsgBox("Hello World!")

[Java]

class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}

[HTML - kinda pushing it lol]

<HTML><HEAD>
<p>Hello World!</p>
</HEAD></HTML>

[Python]

Print "Hello World!"

[Assembly (The BEST for real)]

org 100h
mov dx,msg
mov ah,9
int 21h
mov ah,4Ch
int 21h
msg db 'Hello, World!',0Dh,0Ah,'$'


Well I guess that's all I know. And yes. I've studied them all :) MWAHAHA I am king mwahahaha.. no for real if anyone needs help I'll be here.

^_^
Jojodi
 
c#

using System;

class Bjoobies {

static Main() {
Console.WriteLine("Hello World!!1!!!")
}
}
turing:

put "Hello World"
 
<?php
print "Hello, World!";
?>

Edit: Ok, so it's a scripting language. Close enough.
 
MEL, for the Maya users:

Code:
string $A = "Hello World!";

print $A;
 
"Hello World" in Mercury, which is a language I happen to find quite interesting.

Code:
:- module hello_world.

:- interface.

:- import_module io.

:- pred main(io__state, io__state).
:- mode main(di, uo) is det.

:- implementation.

main -->
	io__write_string("Hello, World!\n").
 
Keep em coming - scripting languages are fine, anything is really. Here's one in *compliant* XHTML Strict:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
	<title>Hello World</title>
</head>

<body>

<p>
	Hello World!
</p>

</body>

</html>
 
class Abeginning2
{
public static void main(String[]args)
{
System.out.println("Hello world!");
}
}

EDIT: Yea, just noticed someone already posted this. D'oh.
 
Cobol
Code:
000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID.     HELLOWORLD.
000300
000400*
000500 ENVIRONMENT DIVISION.
000600 CONFIGURATION SECTION.
000700 SOURCE-COMPUTER. RM-COBOL.
000800 OBJECT-COMPUTER. RM-COBOL.
000900
001000 DATA DIVISION.
001100 FILE SECTION.
001200
100000 PROCEDURE DIVISION.
100100
100200 MAIN-LOGIC SECTION.
100300 BEGIN.
100400     DISPLAY " " LINE 1 POSITION 1 ERASE EOS.
100500     DISPLAY "Hello world!" LINE 15 POSITION 10.
100600     STOP RUN.
100700 MAIN-LOGIC-EXIT.
100800     EXIT.

Ok, so I got this from google, but could you really be arsed to write a hello world program in cobol? Bleh.
 
Shh, don't tell anyone. My company produces cobol development software, you could put me out of a job ;)
 
Boo (Uses the Common Language Interface, so it can access .NET stuff)

Code:
print "Hello World"

or

Code:
Import System

Console.WriteLine("Hello World")

The first one is a just a macro of the second most likely.
 
how could you forget c:
Code:
#include <stdio.h>

int main()
{
    printf("Hello World!\n");
    return 0;
}
 
In z80 ASM on a TI83 calculator.
Code:
ld hl,Hello
ld de,0
ld (pencol),de
bcall(_vputs)
ret
Hello:
.db "Hello World!",0
 
This is my favorite one.

brain f-ck

Code:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++.+++++++++++++++++++++++++++++.+++++++..+++.--------------
-----------------------------------------------------.-----------
-.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++.--------.+++.------.--------.-----------
--------------------------------------------------------
.
 
On a TI 67 calculator:

DISP "HELLO WORLD"


Perl:
print "Hello World\n";
 
Delphi
Code:
Begin
  with Application do
  begin
     NormalizeTopMosts;
     MessageBox('This should be on top.', 'Look', [smbOK]);
     RestoreTopMosts;
  end;
end.
Pascal
Code:
program HelloWorld
begin
  writeln('Hello, World!')
end.
I know some QBASIC, VB, Pascal, Dephi, HTML and C++ so all I know have been posted.
 
well, shit. you covered what I know by the second post.

wait... i got it...

Code:
var tempUnits = app.preferences***lerUnits;

app.preferences***lerUnits = Units.PIXELS;

var docRef = app.documents.add(300, 70, 72, "Hello World", NewDocumentMode.RGB, DocumentFill.WHITE);
var layerRef = docRef.artLayers.add();
layerRef.kind = LayerKind.TEXT;
layerRef.name = "Hello World!"

layerRef.textItem.contents = "Hello World!";
layerRef.textItem.position = [24,48];
layerRef.textItem.size = 36;
layerRef.textItem.font = "LucidaConsole";

app.preferences***lerUnits = tempUnits;
...photoshop :E

okay, it's technically javascript, but wth ever.
 
Well, Im almost done doing my Prolog Project, so I guess I should try it with that language, or I could also do scheme(But I have no clue how to do it with that language).

helloWorld :- display('Hello World!') , nl .

I do have a question if anyone knows Prolog, How do you do unlimited precision arithmetic with times? I want to multiply a number like 66674456645454353543545 * 3432432423423424234. I got a little of the code, but Im not sure how to completely finish it. It only Multiplies a Large number by a four digit number.

times([], R, 0, []).
times([], R, Carry, [Carry]).
times([X|Y], Arg, Carry, [P|Q]) :- Temp is X * Arg + Carry,
P is Temp mod 10000, NewCarry is Temp // 10000,
times(Y, Arg, NewCarry, Q).
 
Unrealscript:

-------------------------------------------------------------------
class HelloWorldHUD extends HudBase;

simulated function DrawHudPassC (Canvas C) //not running
{

C.SetPos( 0.50*C.ClipX , 0.50*C.ClipY);
C.DrawText("Hello, world!");

}

defaultproperties
{
}
-------------------------------------------------------------------

That's what coding a ut2003 mod for a year does to you, people.
That displays it on the center of the HUD every frame. There are many other ways to do this in Unreal.
 
Win32 API In C
Code:
#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
	MessageBox(NULL, "Hello World!", "Hello World!", MB_OK);
	return 0;
}

Visual Basic (with CLR)
Code:
Imports System

Public Class Hello
	Public Sub Main()
		Console.WriteLine("Hello World!")
	End Sub
End Class

Win32 API in MASM
Code:
.386
.model flat, stdcall
option casemap: none
include windows.inc
include kernel32.inc
include user32.inc
includelib kernel32.lib
includelib user32.lib

.data
Hello db "Hello World!",0

.code
start:
push MB_OK
push offset Hello
push offset Hello
push NULL
call MessageBox
push 0
call ExitProcess
end start

Win32 API in NASM
Code:
EXTERN ExitProcess
IMPORT ExitProcess,kernel32.dll
EXTERN MessageBoxA
IMPORT MessageBoxA,user32.dll

segment .data USE32
Hello db "Hello World!",0

segment .code USE32
..start
push dword 0
push dword Hello
push dword Hello
push dword 0
call [MessageBoxA]
push dword 0
call [ExitProcess]

Raw DOS Assembly
Code:
jmp start
Hello db "Hello World!$"
start:
mov ah,09h
mov dx,offset Hello
int 21h
mov ax,004Ch
int 21h

68k Assembly for a TI-89 Calculator
Code:
.xdef _ti89

ASM_loader:
movem.l %d3-%d7/%a2-%a6,-(%sp)
lea (%sp,-3840),%sp
pea 3840
pea 0x4C00
pea (%sp,8)
move.l 0xC8.w,%a0
move.l (%a0,4*0x26a),%a2
jsr (%a2)
jbsr _main
pea 3840
pea (%sp,16)
pea 0x4C00
move.l 0xC8.w,%a0
move.l (%a0,4*0x26a),%a2
jsr (%a2)
lea (%sp,3864),%sp
movem.l (%sp)+,%d3-%d7/%a2-%a6
rts

_main:
link.w %a6,#0
move.l 0xC8,%a5
move.l 4*0x19e(%a5),%a4
jbsr (%a4)
move.w #1,-(%sp)
pea Hello
move.w #0,-(%sp)
move.w #0,-(%sp)
move.l 4*0x1a9(%a5),%a4
jbsr (%a4)
move.l 4*0x51(%a5),%a4
jbsr (%a4)
unlk %a6
rts

.data
Hello:
.string "Hello World!"

.comm _nostub,2

I win. And remember kids, assembly roxx0rz!
 
Well here's the way I do Hello World! in C++ because the window tends to close in milliseconds.

Oh and come on man... SPRUCE IT UP! How bout "Hello HL2.net!" :p

Code:
#include <iostream>

using namespace std;

main()
{
      cout << "Hello HL2.net!" << endl;
      
      
cin.get();
return 0;
}
 
Fine, be that way! :p Here's my rebuttal:

Code:
#include <stdio.h>

int main(int argc, char *argv[])
{
	printf("Hello HL2.net!");
	getchar();
	return 0;
}

Oh and greetz to neozero for posting the brainf*ck version :cheers:
 
Another way to do it in Java:

import javax.swing.JOptionPane;

public class Hello {

public static void main(string args[]) {
{
JOptionPane.showMessageDialog(null, "Hello world);
}
}
}
 
A few

C FORTRAN (g77 compiler)
program Hello
write(6,*) 'Hello, World!'
end

C would probably need
write(6,10)
10 format(x, "Hello, World')
end
C in fortran IV ... something like that.
C 6 is unit #, equiv to std output in C.


# Perl - with subroutine
# you could just use print "Hello, World!\n"
# but that wouldn't be any fun.
do &outMsg;

sub outMsg {
$output = "Hello, World";
print "$output\n";
}



/* PASCAL */
PROGRAM Hello(input, output);
BEGIN
Writeln('Hello, World')
END.


% MATLAB
display('Hello, World!');


@echo off
REM DOS BAT file
@echo "Hello, World!"


#csh
echo "Hello, World!"


%%%% Postscript
%%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 612 792
/Courier-Bold findfont 12 scalefont setfont
0.0 0.0 1.0 setrgbcolor
20.00 20.00 moveto
(Hello, World!) show
showpage


tff
 
lol, I like this thread! :D

How long is it going to be?
 
well, logically, it'll keep going until we run out of languages that someone here knows... so I'm thinking not that much longer.
 
0100100001100101011011000110110001101111001000000101011101101111011100100110110001100100



Hey, why not?
 
Code:
++++++++[->+++++++++<]>.<+++++++[->++++<]>+.+++++++..
+++.>++++++++[->++++<]>.<<++++++++.--------.+++.-----
-.--------.>>+.---[---<+>]<.

Brain****. :)
 
Code:
E9 0D 00 48 65 6C 6C 6F 20 57 6F 72 6C 64 21 24 B4 09 BA 03 01 CD 21 B8 4C 00 CD 21

In freakfury's spirit.
 
Quick-Basic, the only program I've ever coded in;

10
PRINT "Hello world!"
SLEEP 3
CLS
SLEEP 1
GOTO 10

:D
 
Back
Top