“Hello, World!”程序是一个只在计算机屏幕上打印出“Hello, World!”(英语,意为“世界,你好!”)字串的计算机程序。该程序通常是计算机程序设计语言的初学者所要学习编写的第一个程序。它还可以用来确定该语言的编译器、程序开发环境以及运行环境已经正确安装。 k_Lv\'Ok
.tK]-f2
将Hello World程序作为第一个学写的程序,现在已经成为一种传统。该程序最早出现在由Brian Kernighan和Dennis Ritchie写的计算机程序设计教程《C语言程序设计》。 Hq,NOP
-&QpQ7q1
以下是用不同语言写成的Hello World程序的几个例子: )Rj?\ZUR
Ada t3!~=U
with Ada.Text_Io; use Ada.Text_Io; 5o0H7k]
procedure Hello is u0$}VO5/a
begin lO}I>yo}\
Put_Line ("Hello, world!"); T'N/A9{q
end Hello; 4*UKR!sr
7qdB
9v7}[`^
汇编语言 0 Gq<APtr
,rhNXx
x86 CPU,DOS,TASM xDmwiVy
MODEL SMALL NF7+Gp6?q
IDEAL ,~NJ}4wP
STACK 100H e^hI[LbNC
ZPHatC
DATASEG w}x&wWM
HW DB 'Hello, world!$' cn'rBY
Qaiqx"x3
CODESEG =z}M(<G
MOV AX, @data iF"kR]ZL
MOV DS, AX gyCXv0*z
MOV DX, OFFSET HW i\{fM}~W$
MOV AH, 09H rP}0B/
INT 21H )U{IQE;T#
MOV AX, 4C00H ~VPE9D@
INT 21H ~vfPsaRh
END @%6"xnb`
OL623jQX
1c$ce+n~
x86 CPU,GNU/Linux,NASM {.r9l
;"Hello World" for Linux on Intel 80x86 using nasm (Intel syntax).
L$ [1+*
;Enter this into "hello.asm" then type: '^.3}N{Fo
;"nasm -f elf hello.asm" @DyMq3Gt?&
;"ld hello.o -o hello" -nB.
.q
;"./hello" 2c5)pIVEy
4& 9V
section .data ;data section declaration x|3G}[=
msg db 'Hello World!',0AH ES[]A&tf
len equ $-msg ;string length 4TaHS!9
H(Ad"1~.#
section .text ;code section declaration ,^qHl+'
global _start ;entry point (start of execution) @Sz7*p
_start: mov edx,len ;string length * YTv"
mov ecx,msg ;string start 7*47mJyc
mov ebx,1 ;file handle: stdout ,f[Oy:fr
mov eax,4 ;sys_write 0y/P
int 80h ;kernel system call OF`:);
2O0<