“Hello, World!”程序是一个只在计算机屏幕上打印出“Hello, World!”(英语,意为“世界,你好!”)字串的计算机程序。该程序通常是计算机程序设计语言的初学者所要学习编写的第一个程序。它还可以用来确定该语言的编译器、程序开发环境以及运行环境已经正确安装。 3uN;*f
CnJO]0Op3
将Hello World程序作为第一个学写的程序,现在已经成为一种传统。该程序最早出现在由Brian Kernighan和Dennis Ritchie写的计算机程序设计教程《C语言程序设计》。 (;!&RZ
yXlzImPn
以下是用不同语言写成的Hello World程序的几个例子: 'GAjx{gM
Ada ,KZ_#9[>
with Ada.Text_Io; use Ada.Text_Io; X.g1
312~
procedure Hello is 0'a.Ypf
begin {AJspLcG
Put_Line ("Hello, world!"); L>cTI2NB.
end Hello; x H\5T!
!)ee{CwNc
d6wsT\S
汇编语言 g&v2=&aj
Zpg$:Rr
x86 CPU,DOS,TASM 75gE>:f
MODEL SMALL Dk/;`sXV
IDEAL 7v#sr<
STACK 100H BsRxD9r
'r3I/qg*m
DATASEG {G_ZEo#x8,
HW DB 'Hello, world!$' )
_"`{2
\
VJ3
CODESEG )~rN{W<s`H
MOV AX, @data GBN^ *I
MOV DS, AX ~fEgrF d
MOV DX, OFFSET HW c}lUP(Ss
MOV AH, 09H 7)z^*;x
INT 21H m\[r6t]V
MOV AX, 4C00H |6$6Za]:
INT 21H mI@]{K}Q%
END LY/K,6^a
/z`LB
<!R~G-D#_T
x86 CPU,GNU/Linux,NASM 0zetOlFbO
;"Hello World" for Linux on Intel 80x86 using nasm (Intel syntax). nCJ)=P.d
;Enter this into "hello.asm" then type: G,%R`Xns
;"nasm -f elf hello.asm" G|v{[>tr
;"ld hello.o -o hello" rD
fUTfv|Q
;"./hello" ~gmj/PQ0
:,% vAI
section .data ;data section declaration <t&0[l
msg db 'Hello World!',0AH )y_MI
r
len equ $-msg ;string length zJOL\J'
f8!*4Bw
section .text ;code section declaration b<NI6z8\
global _start ;entry point (start of execution) 3`$-
_start: mov edx,len ;string length K'Wg_ihA
mov ecx,msg ;string start +,f|Y6L<