“Hello, World!”程序是一个只在计算机屏幕上打印出“Hello, World!”(英语,意为“世界,你好!”)字串的计算机程序。该程序通常是计算机程序设计语言的初学者所要学习编写的第一个程序。它还可以用来确定该语言的编译器、程序开发环境以及运行环境已经正确安装。 \cQ .|S
%6ub3PLw8
将Hello World程序作为第一个学写的程序,现在已经成为一种传统。该程序最早出现在由Brian Kernighan和Dennis Ritchie写的计算机程序设计教程《C语言程序设计》。 iePf ]O*
VXm[-
以下是用不同语言写成的Hello World程序的几个例子: wqD5d
Ada 7byCc_,
with Ada.Text_Io; use Ada.Text_Io; 8~ #M{}
procedure Hello is uLN[*D
begin _8><| 3d
Put_Line ("Hello, world!"); M=y0PCD
end Hello; }"zC
>eX&
}q!_!q,@
KrKu7]If6#
汇编语言 ;;V\"7q'
KWhZ +i`
x86 CPU,DOS,TASM - 8bNQU
MODEL SMALL }rbZ&IN\?E
IDEAL 6;oe=Q:Q
STACK 100H ;GsQR+en
/N)5
3!LT
DATASEG 8LJ{i%
HW DB 'Hello, world!$' !@g)10u
1f4bt6[
CODESEG ;/LD)$_
MOV AX, @data u+D[_yd^
MOV DS, AX x*}bo))hb
MOV DX, OFFSET HW }!)F9r@\
MOV AH, 09H 8]< f$3.
INT 21H 0{) $SY
MOV AX, 4C00H 4vdNMV~
INT 21H 'iUg[{'+
END feEMg
GXX+}=b7qO
SwH2$:f
x86 CPU,GNU/Linux,NASM &ZJgQ-Pc(m
;"Hello World" for Linux on Intel 80x86 using nasm (Intel syntax). ^#e~g/
;Enter this into "hello.asm" then type: Veji^-0E
;"nasm -f elf hello.asm" rt4Z;
;"ld hello.o -o hello" O~@fXMthh
;"./hello" 8Fq_i-u
xh0 xSqDM
section .data ;data section declaration T_#,
A0 G
msg db 'Hello World!',0AH -<N&0F4|*
len equ $-msg ;string length K`k'}(vj
nWWM2v
section .text ;code section declaration 8`v$liH
global _start ;entry point (start of execution) H?yE3w
_start: mov edx,len ;string length \cuS>G
mov ecx,msg ;string start Tby,J
B^U
mov ebx,1 ;file handle: stdout SKXD^OH
mov eax,4 ;sys_write F}X0',
int 80h ;kernel system call A^Cj1:,
ohQAA h
mov ebx,0 ;return value ]hTb@.
mov eax,1 ;sys_exit l@~LV}BI
int 80h ;kernel system call 3HiFISA*
YQ(Po!NI\'
2t1I3yA'{z
x86 CPU,Windows,MASM32 NZXjE$<Vr
.386 Lz4ehWntO
.model flat,stdcall Bw<rp-
option casemap:none ZR3nK0
;Include 文件定义 7}B
include windows.inc .36^[Jsz":
include user32.inc &ak6zM
includelib user32.lib y79qwM.
include kernel32.inc c-CYdi@
includelib kernel32.lib y' x F0
;数据段 @q8an
.data ,&]MOe4@>
szCaption db 'A MessageBox!',0 '2^
Yw
szText db 'Hello,world!',0 w+AuMc
;代码段 #DI$Oc
.code /-Qv?"
start: p25Fn`}H
invoke MessageBox,NULL,offset szText,offset szCaption,MB_OK 3/goCg
invoke ExitProcess,NULL ]tt} #
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ?m"|QS!!K
end start LSd*|3E}n
rPiNv
30L
\7Cg,Xn
AWK `l]j#qshTm
BEGIN { print "Hello, world!" } ]=&L