“Hello, World!”程序是一个只在计算机屏幕上打印出“Hello, World!”(英语,意为“世界,你好!”)字串的计算机程序。该程序通常是计算机程序设计语言的初学者所要学习编写的第一个程序。它还可以用来确定该语言的编译器、程序开发环境以及运行环境已经正确安装。 Ms3GvPsgv
)L":I
将Hello World程序作为第一个学写的程序,现在已经成为一种传统。该程序最早出现在由Brian Kernighan和Dennis Ritchie写的计算机程序设计教程《C语言程序设计》。 Fwvc+ a
&oZU=CN
以下是用不同语言写成的Hello World程序的几个例子: 77+3CME{'
Ada @x[A^
with Ada.Text_Io; use Ada.Text_Io; k%sxA
procedure Hello is \j.l1O
begin T.%yeJiE
Put_Line ("Hello, world!"); JXt_
end Hello; Ck
m:;q
f\RTO63|O
"?iyvzo
汇编语言 K,PN:
-~_|ZnuM9
x86 CPU,DOS,TASM y>T>
MODEL SMALL IQd~`
G
IDEAL Tgla_sMb
STACK 100H b8%TwYp
{od@Sl
DATASEG &(p5z4Df
HW DB 'Hello, world!$' pnL[FMc
hc9ON&L\>
CODESEG jWvi%Iqi
MOV AX, @data xd"+ &YT
MOV DS, AX N<Ym&$xR
MOV DX, OFFSET HW L0{[L
MOV AH, 09H ) 3f\H
INT 21H q^ &r<i
MOV AX, 4C00H sS4V(:3s
INT 21H t-}IKrbv
END ![I|hB
DV>;sCMJ %
`6# s+JA[
x86 CPU,GNU/Linux,NASM 1TGE>HG
;"Hello World" for Linux on Intel 80x86 using nasm (Intel syntax). w7q6v>
;Enter this into "hello.asm" then type: 3U!=R-
;"nasm -f elf hello.asm" |S<!'rY
;"ld hello.o -o hello" gg#lI|
;"./hello" eZhF<<Y
g "c7$
section .data ;data section declaration H,7!"!?@N
msg db 'Hello World!',0AH (_3'nFg
len equ $-msg ;string length @W==)S%O
:>H{?
section .text ;code section declaration ug"4P.wI
global _start ;entry point (start of execution) )7#3n(_np
_start: mov edx,len ;string length N
K@6U_/W
mov ecx,msg ;string start \PG_i' R
mov ebx,1 ;file handle: stdout c&