“Hello, World!”程序是一个只在计算机屏幕上打印出“Hello, World!”(英语,意为“世界,你好!”)字串的计算机程序。该程序通常是计算机程序设计语言的初学者所要学习编写的第一个程序。它还可以用来确定该语言的编译器、程序开发环境以及运行环境已经正确安装。 NMy+=GZu^
.="/n8B
将Hello World程序作为第一个学写的程序,现在已经成为一种传统。该程序最早出现在由Brian Kernighan和Dennis Ritchie写的计算机程序设计教程《C语言程序设计》。 qH=<8Iu
bb4 `s0
以下是用不同语言写成的Hello World程序的几个例子: u4KP;_,m
Ada Au\j6mB
with Ada.Text_Io; use Ada.Text_Io; X]1Q# $b
procedure Hello is :>q*#vlb
begin F
]x2;N
Put_Line ("Hello, world!"); *+UgrsRk
end Hello; xwJ.cy
ob_*fP
)IFFtU~,
汇编语言 L,/(^0;
VpO+52&
x86 CPU,DOS,TASM x
&
ZW
f?
MODEL SMALL O{{\jn|lR
IDEAL ll^#I/
STACK 100H %7wNS
j*fs [4
DATASEG =jWjUkm2
HW DB 'Hello, world!$' Z(|'zAb^
'
X9D( ?O
CODESEG s[n*fV']A
MOV AX, @data hMNC]
MOV DS, AX ]n
'FD|
MOV DX, OFFSET HW 8q/3}AnI
MOV AH, 09H U3tA"X.K
INT 21H w|G4c^KH
MOV AX, 4C00H cYx.<b
JH
INT 21H .kqH}{hf
END it)!-[:bm
l\DcXgD
x
Z1Pdnc7S[
x86 CPU,GNU/Linux,NASM O?OG`{k
;"Hello World" for Linux on Intel 80x86 using nasm (Intel syntax). INF}~DN]
;Enter this into "hello.asm" then type: !?aL_{7J
;"nasm -f elf hello.asm" JBMJR
;"ld hello.o -o hello" :$f9(f&
;"./hello" d8Sr,t+
A>B_~=
section .data ;data section declaration ;Ob`B@!=b
msg db 'Hello World!',0AH ><DXT nt'x
len equ $-msg ;string length f2]O5rXp
LQ{z}Ay
section .text ;code section declaration J5#shs[M:
global _start ;entry point (start of execution) 5tUN'KEbN
_start: mov edx,len ;string length *V[6ta'
mov ecx,msg ;string start =2&