“Hello, World!”程序是一个只在计算机屏幕上打印出“Hello, World!”(英语,意为“世界,你好!”)字串的计算机程序。该程序通常是计算机程序设计语言的初学者所要学习编写的第一个程序。它还可以用来确定该语言的编译器、程序开发环境以及运行环境已经正确安装。 9#/z[!
Vlce^\s;
将Hello World程序作为第一个学写的程序,现在已经成为一种传统。该程序最早出现在由Brian Kernighan和Dennis Ritchie写的计算机程序设计教程《C语言程序设计》。 ZP*Hx
%U
SS
O$.rp
以下是用不同语言写成的Hello World程序的几个例子: k\Oy\z@
Ada 5wRDH1z@{
with Ada.Text_Io; use Ada.Text_Io; >9F,=63A
procedure Hello is DyG3|5s1R
begin b.h~QyI/W
Put_Line ("Hello, world!"); kX\t0'=]
end Hello; J7emoD[
,Zzh. z::D
%fh
,e5(LT
汇编语言 *FR
Eh@R
;%]Q%7
x86 CPU,DOS,TASM C>N)~Ut
MODEL SMALL 1]fqt[*)
IDEAL ;38DB o
STACK 100H sqei(OXy
i5|A\Wv"
DATASEG ~m[^|w
HW DB 'Hello, world!$' W$B>O
)#T(2A
CODESEG ]&yO>\MgJB
MOV AX, @data Mmbb}(<
MOV DS, AX SYB
}
e
MOV DX, OFFSET HW k5xzC&
MOV AH, 09H 6"[`"~9'V
INT 21H :doP66["!
MOV AX, 4C00H sBu=@8R]y
INT 21H =iRc&
END X82sw>Y
"X>Z!>
0+;.T1?
x86 CPU,GNU/Linux,NASM /81Ux@,(e
;"Hello World" for Linux on Intel 80x86 using nasm (Intel syntax). /Y:_qsO1
;Enter this into "hello.asm" then type: B y6:
;"nasm -f elf hello.asm" B~lrd#qC
;"ld hello.o -o hello" _,NL;66=[
;"./hello" W*u Yb|0
"Hg.pDNZ
section .data ;data section declaration :bW}*0b-
msg db 'Hello World!',0AH Bb]pUb
len equ $-msg ;string length
):+n!P
d vkA-9
section .text ;code section declaration @?3u|m |Z
global _start ;entry point (start of execution) (#eB%
_start: mov edx,len ;string length Bg"b,&/^u
mov ecx,msg ;string start @YU}0&