“Hello, World!”程序是一个只在计算机屏幕上打印出“Hello, World!”(英语,意为“世界,你好!”)字串的计算机程序。该程序通常是计算机程序设计语言的初学者所要学习编写的第一个程序。它还可以用来确定该语言的编译器、程序开发环境以及运行环境已经正确安装。 [70Y,,w
bC6X?m=
将Hello World程序作为第一个学写的程序,现在已经成为一种传统。该程序最早出现在由Brian Kernighan和Dennis Ritchie写的计算机程序设计教程《C语言程序设计》。 b7Yq_%+
cS4xe(n8
以下是用不同语言写成的Hello World程序的几个例子: aWdUuid
Ada nZe\5`
with Ada.Text_Io; use Ada.Text_Io; AmZuo_
procedure Hello is bG52s
begin ~Hs=z$
Put_Line ("Hello, world!"); HP#ki !'
end Hello; HTw#U2A;+
Lg8]dBXu
2ed@HJu
汇编语言 d"Bo8`_
.Xi2G@D
x86 CPU,DOS,TASM DQcWq'yY^
MODEL SMALL 0(\p<qq
IDEAL .hxin[Y
STACK 100H q{/*n]K
S=4R5igrC
DATASEG V_jiOT!
HW DB 'Hello, world!$' +5#x6[
vXc!Zg~
CODESEG /=bSt
MOV AX, @data cY{I:MA+h@
MOV DS, AX t`uc3ta"9
MOV DX, OFFSET HW r;9z5'
MOV AH, 09H 0"4J"q]&
INT 21H )4PB<[u
MOV AX, 4C00H |%-YuD
INT 21H Rb?~ Rs\
END y!F:m=x<
Urn
:u
AjV
x86 CPU,GNU/Linux,NASM tO7I&LNE
;"Hello World" for Linux on Intel 80x86 using nasm (Intel syntax). %U-Qsy8|D)
;Enter this into "hello.asm" then type: $]Jf0_
;"nasm -f elf hello.asm" 5|5=Y/
;"ld hello.o -o hello" aJa.U^1{
;"./hello" !f@XDW&R
Trpgx
section .data ;data section declaration )x)gHY8;
msg db 'Hello World!',0AH xwi!:PAf,o
len equ $-msg ;string length R<>tDwsZGa
z[*zuo
section .text ;code section declaration KA?v.s
global _start ;entry point (start of execution) &