“Hello, World!”程序是一个只在计算机屏幕上打印出“Hello, World!”(英语,意为“世界,你好!”)字串的计算机程序。该程序通常是计算机程序设计语言的初学者所要学习编写的第一个程序。它还可以用来确定该语言的编译器、程序开发环境以及运行环境已经正确安装。 <!m'xOD
l%^VBv>
2
将Hello World程序作为第一个学写的程序,现在已经成为一种传统。该程序最早出现在由Brian Kernighan和Dennis Ritchie写的计算机程序设计教程《C语言程序设计》。 S]#xG+$<
S(nZ]QEG
以下是用不同语言写成的Hello World程序的几个例子: g4"0:^/
Ada { t1|6R0
with Ada.Text_Io; use Ada.Text_Io; dY6A)[dAH'
procedure Hello is ^S]-7>Yyr
begin S>y(3E]I
Put_Line ("Hello, world!"); #x^dR-@
end Hello; _pZaVx
F]L$xU
L
UitY
汇编语言 S, g/2k*
M!Hn`_E
x86 CPU,DOS,TASM dd=';%?
MODEL SMALL G,]%dZHe
IDEAL R qnT*
STACK 100H p#fd+
=!pfgE
DATASEG 7=e!k-G
HW DB 'Hello, world!$' yi-S^
=:~%$5[[
CODESEG FR%u1fi
MOV AX, @data PRo;NE
MOV DS, AX A"$UU6Z4
MOV DX, OFFSET HW Aqp$JM
>
MOV AH, 09H FdZG%N>Z
INT 21H :p6.v>s8
MOV AX, 4C00H bm Hl\?
INT 21H +2WvGRC
END H/Wo~$
Kq. MmR!gl
mxxuD"5
x86 CPU,GNU/Linux,NASM &t0toEj
;"Hello World" for Linux on Intel 80x86 using nasm (Intel syntax). } eL*gy
;Enter this into "hello.asm" then type: _U%fD|t
;"nasm -f elf hello.asm" .&Rj2d
;"ld hello.o -o hello" }%m:^*@$9
;"./hello" [`'[)B
$&