“Hello, World!”程序是一个只在计算机屏幕上打印出“Hello, World!”(英语,意为“世界,你好!”)字串的计算机程序。该程序通常是计算机程序设计语言的初学者所要学习编写的第一个程序。它还可以用来确定该语言的编译器、程序开发环境以及运行环境已经正确安装。 f>\OT
#A<|hh
将Hello World程序作为第一个学写的程序,现在已经成为一种传统。该程序最早出现在由Brian Kernighan和Dennis Ritchie写的计算机程序设计教程《C语言程序设计》。 HPl!r0 h
WqP>cl2Lm
以下是用不同语言写成的Hello World程序的几个例子: Y)^qF)v,d
Ada RNGTSz
with Ada.Text_Io; use Ada.Text_Io; XzI c<81Z
procedure Hello is rB|Mp!g%@
begin meunAEe
Put_Line ("Hello, world!"); tz0@csXV
end Hello; 'WK}T)o
Qb}7lm{r
S!Ue+jW
汇编语言 {|?OKCG{
vWY}+#
x86 CPU,DOS,TASM BE. v+'c"
MODEL SMALL i0DYdUj
IDEAL vRa|lGeW
STACK 100H p6m](Jg
C{>@b:]p
DATASEG ?hUC#{
HW DB 'Hello, world!$' 'U
',9
92_F8y*D
CODESEG # D"TY-$.=
MOV AX, @data <"w;:Zs
MOV DS, AX V\^rs41$;
MOV DX, OFFSET HW /.<%y8v
MOV AH, 09H D>M
a3g
INT 21H e^kccz2f
MOV AX, 4C00H 4DI.RK9
INT 21H RG/M-
END wy6> ^_z
9,|{N(N<!
?95^&4Oh0
x86 CPU,GNU/Linux,NASM kG_ K &,;@
;"Hello World" for Linux on Intel 80x86 using nasm (Intel syntax). gX<"-,5jc
;Enter this into "hello.asm" then type: |_L\^T|6
;"nasm -f elf hello.asm" T|^rFaA
;"ld hello.o -o hello" jqq96hP,
;"./hello" #mg6F$E
YW55iyM
section .data ;data section declaration lJ.:5$2H
msg db 'Hello World!',0AH ETvn$ Jdp
len equ $-msg ;string length %,f|H :+>u
RM\it"g
section .text ;code section declaration "jBrPCB
8
global _start ;entry point (start of execution) Dyv 6K_,
_start: mov edx,len ;string length v}p'vh^8B
mov ecx,msg ;string start h|OqM:J;
mov ebx,1 ;file handle: stdout +c4]}9f!
mov eax,4 ;sys_write N*z_rZE
int 80h ;kernel system call ']1\nJP[=X
?"f\"N
mov ebx,0 ;return value q<(yNqMKP
mov eax,1 ;sys_exit [uCW8:e
int 80h ;kernel system call =H&{*Ja
8 tMfh
QA?e2kd
x86 CPU,Windows,MASM32 ^ FNvVbK|`
.386 5&a4c"fU
.model flat,stdcall M{I8b<hY
option casemap:none ipU,.@~#
;Include 文件定义 Eukj2a
include windows.inc )RA$E`!b
include user32.inc ]la8MaZ<