汇编:
;Description:在dos下显示一句话
;入口参数: ah=09H
;ds:dx=待输出字符的地址
;说明:待显示的字符串以’$’作为其结束标志
data segment
str db 'Hello,World!',0ah,0dh,'press any key to exit',0dh,0ah,'$'
data ends
汇编:
;Description:在dos下显示一句话
;入口参数: ah=09H
;ds:dx=待输出字符的地址
;说明:待显示的字符串以’$’作为其结束标志
data segment
str db 'Hello,World!',0ah,0dh,'press any key to exit',0dh,0ah,'$'
data……
[/Quote]
prognam segment
main proc far
assume cs:prognam,ds:datarea
start:
push d.s.
sub ax,ax
push ax
mov ax,datarea
mov ds,ax
lea dx,string
mov ah,09
int 21h
ret
main endp
prognam ends
end start
Cω
using System;
class Hello
{
public static void Main(string[] args)
{
Console.Write("Hello World!\n");
}
}
--------------------------------------------------------------------------------
BLISS:
%TITLE \'HELLO_WORLD\'
MODULE HELLO_WORLD (IDENT=\'V1.0\', MAIN=HELLO_WORLD,
ADDRESSING_MODE (EXTERNAL=GENERAL)) =
BEGIN
LIBRARY \'SYS$LIBRARY:STARLET\';
EXTERNAL ROUTINE
LIB$PUT_OUTPUT;
GLOBAL ROUTINE HELLO_WORLD =
BEGIN
LIB$PUT_OUTPUT(%ASCID %STRING(\'Hello World!\'))
END;
END
ELUDOM
--------------------------------------------------------------------------------
SPARK
with Spark_IO;
--# inherit Spark_IO;
--# main_program;
procedure Hello_World
--# global in out Spark_IO.Outputs;
--# derives Spark_IO.Outputs from Spark_IO.Outputs;
is
begin
Spark_IO.Put_Line (Spark_IO.Standard_Output, "Hello World!", 0);
end Hello_World;
--------------------------------------------------------------------------------
Heron:
program HelloWorld;
functions
{
_main()
{
print_string("Hello, world!");
}
}
End
Scala:
object HelloWorld with Application
{
Console.println("Hello, world!");
}
SPARK:
with Spark_IO;
--# inherit Spark_IO;
--# main_program;
procedure Hello_World
--# global in out Spark_IO.Outputs;
--# derives Spark_IO.Outputs from Spark_IO.Outputs;
is
begin
Spark_IO.Put_Line (Spark_IO.Standard_Output, "Hello World!", 0);
end Hello_World;
Modula-2
MODULE Hello;
FROM Terminal2 IMPORT WriteLn; WriteString;
BEGIN
WriteString("Hello, world!");
WriteLn;
END Hello;
Oberon
MODULE Hello;
IMPORT Oberon, Texts;
VAR W: Texts.Writer;
PROCEDURE World*;
BEGIN
Texts.WriteString(W, "Hello World!");
Texts.WriteLn(W);
Texts.Append(Oberon.Log, W.buf)
END World;
BEGIN
Texts.OpenWriter(W)
END Hello.
13. D
import std.c.stdio;
int main(char[][] args)
{
printf("Hello World!\n");
return 0;
}
14. Eiffel
class HELLO_WORLD
creation
make
feature
make is
local
iBASIC_IO
do
!!io
io.put_string("%N Hello World!")
end -- make
end -- class HELLO_WORLD
17. Fortran
program Hello
write(*,*) \'Hello World!\'
end
18. Haskell
module HelloWorld (main) where
main = putStr "Hello World!\n"
19. Icon
procedure main()
write("Hello World!\n")
end
20. INTERCAL
PLEASE DO ,1 <- #13
DO ,1 SUB #1 <- #238
DO ,1 SUB #2 <- #112
DO ,1 SUB #3 <- #112
DO ,1 SUB #4 <- #0
DO ,1 SUB #5 <- #64
DO ,1 SUB #6 <- #238
DO ,1 SUB #7 <- #26
DO ,1 SUB #8 <- #248
DO ,1 SUB #9 <- #168
DO ,1 SUB #10 <- #24
DO ,1 SUB #11 <- #16
DO ,1 SUB #12 <- #158
DO ,1 SUB #13 <- #52
PLEASE READ OUT ,1
PLEASE GIVE UP
21. Iptscrae
ON ENTER {
"Hello, " "World!" & SAY
}
22. Java
// 命令行界面:
class Hello
{
public static void main(String ars[])
{
System.out.print("Hello World!\n");
}
}
24. MIXAL
TERM EQU 19 the MIX console device number
ORIG 1000 start address
START OUT MSG(TERM) output data at address MSG
HLT halt execution
MSG ALF "MIXAL"
ALF " HELL"
ALF "O WOR"
ALF "LD "
END START end of the program
25. MSIL
.assembly Hello
{
.ver 1:0:0:0
}
.method public static void main() il managed
{
.entrypoint
.maxstack 1
ldstr "Hello World!\n"
call void [mscorlib]System.Console::Write(class System.String)
ret
}
26. OCaml
print_endline "Hello world!";;
27. OPL
PROC hell
PRINT "Hello, World"
ENDP
28. oz
functor $
import
Application
System
define
{System.print \'Hello World!\'}
{Application.exit 0}
end
29. Pascal
program Hello;
begin
writeln(\'Hello, world!\');
end.
汇编:
;Description:在dos下显示一句话
;入口参数: ah=09H
;ds:dx=待输出字符的地址
;说明:待显示的字符串以’$’作为其结束标志
data segment
str db 'Hello,World!',0ah,0dh,'press any key to exit',0dh,0ah,'$'
data ends