“Hello, World!”程序是一个只在计算机屏幕上打印出“Hello, World!”(英语,意为“世界,你好!”)字串的计算机程序。该程序通常是计算机程序设计语言的初学者所要学习编写的第一个程序。它还可以用来确定该语言的编译器、程序开发环境以及运行环境已经正确安装。 PobX;Z
FaL\6w
将Hello World程序作为第一个学写的程序,现在已经成为一种传统。该程序最早出现在由Brian Kernighan和Dennis Ritchie写的计算机程序设计教程《C语言程序设计》。 >rSjP1-F
(o^tmH*
以下是用不同语言写成的Hello World程序的几个例子: "HMEoZ
Ada _Cmmx`ln
with Ada.Text_Io; use Ada.Text_Io; "[ bkdL<
procedure Hello is L$ZjMJ
begin d>NGCe
Put_Line ("Hello, world!"); 7FB?t<x
end Hello; B VBn.ut
8:ubtB
Kb.qv)6i*
汇编语言 D!<F^mtl
wu41Mz7
x86 CPU,DOS,TASM ?YhDjQs
MODEL SMALL L.Y3/H_
IDEAL 8Sbz)X
STACK 100H ,UNb#=it
ZoW1Cc&p
DATASEG 6EqA Y`y
HW DB 'Hello, world!$'
TBj 2(Z
&qv~)ZM$
CODESEG Y0LZbT3
MOV AX, @data IkrB}
MOV DS, AX Y-VDi.]W
MOV DX, OFFSET HW ]z'&oz
MOV AH, 09H =~D? K9o
INT 21H iSW2I~PD
MOV AX, 4C00H d
t/AAk6
INT 21H o3J#hQrl
END H;Wrcf2
O[@!1SKT0
=%Y1] F
x86 CPU,GNU/Linux,NASM k(gbUlCc
;"Hello World" for Linux on Intel 80x86 using nasm (Intel syntax). K9!HW&?<|
;Enter this into "hello.asm" then type: }LHYcNw^z
;"nasm -f elf hello.asm" ^&zCPUH
;"ld hello.o -o hello" TOwd+]B
;"./hello" &?<uR)tl
X Xque-
section .data ;data section declaration (lk9](;L
msg db 'Hello World!',0AH TCr4-"`r-{
len equ $-msg ;string length ^Hd[+vAvR
( }-*irSsj
section .text ;code section declaration _&<n'fK[
global _start ;entry point (start of execution) 5mH[|_
_start: mov edx,len ;string length _^NX`<&
mov ecx,msg ;string start > p`,
mov ebx,1 ;file handle: stdout .<x6U*)\O
mov eax,4 ;sys_write C{exvLQ
int 80h ;kernel system call I!x.bp~V!
KX)n+{
mov ebx,0 ;return value 2d)Dhxzxk
mov eax,1 ;sys_exit /6x&%G:m#
int 80h ;kernel system call 8 Rx@_
]\,?u /
["-rDyP
x86 CPU,Windows,MASM32 z0"t]4s
.386 @rl5k(
.model flat,stdcall r- 8Awa
option casemap:none ^y+k6bE
;Include 文件定义 Z,&