“Hello, World!”程序是一个只在计算机屏幕上打印出“Hello, World!”(英语,意为“世界,你好!”)字串的计算机程序。该程序通常是计算机程序设计语言的初学者所要学习编写的第一个程序。它还可以用来确定该语言的编译器、程序开发环境以及运行环境已经正确安装。 f`n4'dG
iM@$uD$_Q2
将Hello World程序作为第一个学写的程序,现在已经成为一种传统。该程序最早出现在由Brian Kernighan和Dennis Ritchie写的计算机程序设计教程《C语言程序设计》。 hyH[`wiq
ysz =Xw
以下是用不同语言写成的Hello World程序的几个例子: m+0yf(w
Ada dymq
Z<
with Ada.Text_Io; use Ada.Text_Io; .\ ;'>qy
procedure Hello is UJL2IF-x
begin 1uAjy(y
Put_Line ("Hello, world!"); +nE>)ZH
end Hello; _#u\ar)
f' ?/P~[
Q#\Nhc
汇编语言 d5$D[,`1
'OsZD?W{
x86 CPU,DOS,TASM 8M99cx*K
MODEL SMALL wM+1/[7
IDEAL 4.!1odKp
STACK 100H JM3[
yNSN@
B?! L~J@p
DATASEG 6Ijt2c'A}
HW DB 'Hello, world!$' t3@+idE b
&BRk<iwV
CODESEG L[x`i'0B
MOV AX, @data 9MMCWMV
MOV DS, AX Y;/@[AwF
MOV DX, OFFSET HW aUaeK(x:H
MOV AH, 09H 6kYluV+j
INT 21H BpZ~6WtBq
MOV AX, 4C00H 8zp?WUb
INT 21H (`1io
END :C:6bDQ
"'U^8NA2
cUY-
x86 CPU,GNU/Linux,NASM )[ V8YiyU
;"Hello World" for Linux on Intel 80x86 using nasm (Intel syntax). n 9B5D:.G
;Enter this into "hello.asm" then type: *?FVLE
;"nasm -f elf hello.asm" QTy=VLk43
;"ld hello.o -o hello" (BEe^]f
;"./hello" .9bi%=hP
WXy8<?s
section .data ;data section declaration ANhqS
msg db 'Hello World!',0AH 9{u=
len equ $-msg ;string length d4| )=
Tn&