“Hello, World!”程序是一个只在计算机屏幕上打印出“Hello, World!”(英语,意为“世界,你好!”)字串的计算机程序。该程序通常是计算机程序设计语言的初学者所要学习编写的第一个程序。它还可以用来确定该语言的编译器、程序开发环境以及运行环境已经正确安装。 (o1*7_]e
+oZq~2?*S6
将Hello World程序作为第一个学写的程序,现在已经成为一种传统。该程序最早出现在由Brian Kernighan和Dennis Ritchie写的计算机程序设计教程《C语言程序设计》。 XF{ g~M
!po8[fz~x
以下是用不同语言写成的Hello World程序的几个例子: <|M cE
Ada 0@yHT-Dy
with Ada.Text_Io; use Ada.Text_Io; J>YwMl
procedure Hello is !79^M
begin wjF/c
Put_Line ("Hello, world!"); h7NS9CgO
end Hello; jB*%nB*x
ZkW,
a{7>7%[
汇编语言 sS,Swgr
F#X&Tb{
x86 CPU,DOS,TASM -bo5/`x
MODEL SMALL 2Y)3Ue
IDEAL jmbwV,@Q2
STACK 100H (KDUX
t.
Tw< N
DATASEG a a=GW%
HW DB 'Hello, world!$' 0Ii*
"?s
dyRKmLb
CODESEG 9pKN^FX,76
MOV AX, @data JpEE'#r|
MOV DS, AX y]B?{m``6
MOV DX, OFFSET HW W>Eee?
MOV AH, 09H #YM5P
INT 21H [V ~(7U
MOV AX, 4C00H /R&!92I0*
INT 21H
y#5xS
END #Mt'y8|}$
ugEh}3
bwG2=
x86 CPU,GNU/Linux,NASM ^[noGjy
;"Hello World" for Linux on Intel 80x86 using nasm (Intel syntax). 84UH&
b'n
;Enter this into "hello.asm" then type: G};os+FxF
;"nasm -f elf hello.asm" _\YBB=Os
;"ld hello.o -o hello" $R3]y9`?
;"./hello" P%A^TD|
IWvLt
section .data ;data section declaration .az+'1
msg db 'Hello World!',0AH vT V'D&x2
len equ $-msg ;string length 3%Z:B8:<