“Hello, World!”程序是一个只在计算机屏幕上打印出“Hello, World!”(英语,意为“世界,你好!”)字串的计算机程序。该程序通常是计算机程序设计语言的初学者所要学习编写的第一个程序。它还可以用来确定该语言的编译器、程序开发环境以及运行环境已经正确安装。 wu?ahNb.`Y
9 tZ)#@\
将Hello World程序作为第一个学写的程序,现在已经成为一种传统。该程序最早出现在由Brian Kernighan和Dennis Ritchie写的计算机程序设计教程《C语言程序设计》。 rQiX7
FFXDt"i2
以下是用不同语言写成的Hello World程序的几个例子: .0]4@'
Ada wUzQ`h2
with Ada.Text_Io; use Ada.Text_Io; "%~\kJ(G
procedure Hello is v +-f
pl&
begin Q,Tet&in )
Put_Line ("Hello, world!"); fr'M)ox1
end Hello; s
vn[c*
4GJ1P2
'B}pIx6k~
汇编语言 tB.;T0n
=jD[A>3I
x86 CPU,DOS,TASM ZK5(_qW&i
MODEL SMALL 3oX%tx
IDEAL }aYm86C]
STACK 100H MhC74G
1?)iCe
DATASEG xw: v|(
HW DB 'Hello, world!$' .d`+#1Ot(
T=cSTS!P;q
CODESEG Rf@D]+v
MOV AX, @data ;SQ<^"eK
MOV DS, AX Wd4fIegk
MOV DX, OFFSET HW L/(e/Jalg
MOV AH, 09H (^GVy=
INT 21H Myss$gt}
MOV AX, 4C00H <B
5^
INT 21H N_<sCRd]9
END >JT{~SRB|Y
U`q[5U"
^B@4 w\t
x86 CPU,GNU/Linux,NASM RsBo\#`
;"Hello World" for Linux on Intel 80x86 using nasm (Intel syntax). EQPZV
K/
;Enter this into "hello.asm" then type: o;Ijv\Em
;"nasm -f elf hello.asm" 4W8rb'B!Ay
;"ld hello.o -o hello" |Hn[XRsf
;"./hello" IV^LYu
dsDoPo0!
section .data ;data section declaration G],+?E_,
msg db 'Hello World!',0AH d$ Mk
len equ $-msg ;string length ezTu1-m
S-Va_t$
section .text ;code section declaration /rp4m&