“Hello, World!”程序是一个只在计算机屏幕上打印出“Hello, World!”(英语,意为“世界,你好!”)字串的计算机程序。该程序通常是计算机程序设计语言的初学者所要学习编写的第一个程序。它还可以用来确定该语言的编译器、程序开发环境以及运行环境已经正确安装。 _\9|acFT2O
B} %B4&Ij
将Hello World程序作为第一个学写的程序,现在已经成为一种传统。该程序最早出现在由Brian Kernighan和Dennis Ritchie写的计算机程序设计教程《C语言程序设计》。 3 9|4)1e
-\b$5oa(
以下是用不同语言写成的Hello World程序的几个例子: |]dA`e&y
Ada x2|YrkGv
with Ada.Text_Io; use Ada.Text_Io; :3z`+5Y*
procedure Hello is ~JJuM
begin 0'giAA
Put_Line ("Hello, world!"); NDJIaX:]
end Hello; pohA??t2:
?Mb'l4
u*I=.
汇编语言 L8&$o2+07r
{ *"I4
x86 CPU,DOS,TASM 8E m X
MODEL SMALL $c!cO" U
IDEAL |a(%a43fC
STACK 100H tFY;q##z
JMMT886
DATASEG +bG^SH2ke
HW DB 'Hello, world!$' eY)JuJ?
R. sRH/6
CODESEG {9tKq--@E9
MOV AX, @data 2;Ij~~
MOV DS, AX 2VrO8q(
MOV DX, OFFSET HW J33enQd
MOV AH, 09H 3;wAm/Z:Q
INT 21H }r}$8M+1
MOV AX, 4C00H }tvLe3O
INT 21H l\PDou@5
END 8n.sg({g
MeXzWLH
bbDl?m&bq
x86 CPU,GNU/Linux,NASM GOT@
;"Hello World" for Linux on Intel 80x86 using nasm (Intel syntax). (v11;k dJB
;Enter this into "hello.asm" then type: p)5j~Nl
;"nasm -f elf hello.asm" W| z
djb
;"ld hello.o -o hello" 1Na*7|
;"./hello" i8F^ N=
kZ&|.q1zki
section .data ;data section declaration cmpT_51~O
msg db 'Hello World!',0AH qq%\
len equ $-msg ;string length \`H"4r[?(
)20jZm*
section .text ;code section declaration _Eus<c
global _start ;entry point (start of execution) 82S?@%}#J
_start: mov edx,len ;string length e)pQh&uD
mov ecx,msg ;string start y4%u<