“Hello, World!”程序是一个只在计算机屏幕上打印出“Hello, World!”(英语,意为“世界,你好!”)字串的计算机程序。该程序通常是计算机程序设计语言的初学者所要学习编写的第一个程序。它还可以用来确定该语言的编译器、程序开发环境以及运行环境已经正确安装。 zfJT,h-{
/CrSu
将Hello World程序作为第一个学写的程序,现在已经成为一种传统。该程序最早出现在由Brian Kernighan和Dennis Ritchie写的计算机程序设计教程《C语言程序设计》。 KjD/o?JUr
.YtKS
以下是用不同语言写成的Hello World程序的几个例子: ; 5*&xz
Ada .73X3`P25
with Ada.Text_Io; use Ada.Text_Io; Y`~Ut:fZ
procedure Hello is T^zXt?
begin 8 ?xE6
Put_Line ("Hello, world!"); (d(CT;
end Hello; 1KU!
tL
AP3a;4Z#
\[;0KV_
汇编语言 cn3#R.G~
fBU`k_
x86 CPU,DOS,TASM `}p0VmD{NE
MODEL SMALL {a =#B)6
IDEAL pIc#L>{E
STACK 100H p?02C#p
= }~hWL
DATASEG D(~U6SR
HW DB 'Hello, world!$' em y[k
H%[eV8
CODESEG lt/1f{v[:
MOV AX, @data
{y)=eX9
MOV DS, AX 'lH|eU&-
MOV DX, OFFSET HW ncaT?~u j
MOV AH, 09H {B~QQMEow
INT 21H 4VHn \
MOV AX, 4C00H kXViWOXU^
INT 21H ?w$kue
END
2IK}vDsis
P?%s
#I:
Q3 ea{!r
x86 CPU,GNU/Linux,NASM aEB_#1
;"Hello World" for Linux on Intel 80x86 using nasm (Intel syntax). +V2F#fI/
;Enter this into "hello.asm" then type: \P[Y`LYL
;"nasm -f elf hello.asm" ."g`3tVK
;"ld hello.o -o hello" xH ]Ct~md
;"./hello" 9p]QM)M
ldf\;Qk
section .data ;data section declaration d z|or9&
msg db 'Hello World!',0AH )705V|v
len equ $-msg ;string length <NMEGit
_T60;ZI+^
section .text ;code section declaration a,,ex i
global _start ;entry point (start of execution) @@f"%2ZR[
_start: mov edx,len ;string length e1yt9@k,
mov ecx,msg ;string start *tA1az-jO
mov ebx,1 ;file handle: stdout dRYqr}!%n
mov eax,4 ;sys_write /WcG{Wdp
int 80h ;kernel system call y
RqL9t
YP oSRA L
mov ebx,0 ;return value i$Ul(?
mov eax,1 ;sys_exit RU|Q]Ymx
int 80h ;kernel system call JtE M,tK
ijv(9mR
p
T?}Kc
x86 CPU,Windows,MASM32 RHW]Z
Pr<
.386 }RF(CwZr(
.model flat,stdcall )$2QZ
qX
option casemap:none ~ah~cwmpS
;Include 文件定义 >58YjLXb
include windows.inc ELoDd&