“Hello, World!”程序是一个只在计算机屏幕上打印出“Hello, World!”(英语,意为“世界,你好!”)字串的计算机程序。该程序通常是计算机程序设计语言的初学者所要学习编写的第一个程序。它还可以用来确定该语言的编译器、程序开发环境以及运行环境已经正确安装。 LF\4>(C2g
LadE4:oy
将Hello World程序作为第一个学写的程序,现在已经成为一种传统。该程序最早出现在由Brian Kernighan和Dennis Ritchie写的计算机程序设计教程《C语言程序设计》。 df}DJB
nH*JR
以下是用不同语言写成的Hello World程序的几个例子: R"NR-iU
Ada J[6`$$l0
with Ada.Text_Io; use Ada.Text_Io; rPf<8oH
procedure Hello is 9ohaU
begin ]"Y?
ZS;H
Put_Line ("Hello, world!"); yu ~Rk
end Hello; dtHB@\1
4[=vt
e nsou!l
汇编语言 @VlDi1
(~6oA f
x86 CPU,DOS,TASM N#(p_7M
MODEL SMALL "uR,WY
IDEAL I"TFj$Pg
STACK 100H Fk01j;k.H
F@</Ev
DATASEG .EJo9s'
HW DB 'Hello, world!$' DbRq,T
WCc7 MK
CODESEG 1D3{\v
MOV AX, @data wxy.&a]
MOV DS, AX pY75S5h:
MOV DX, OFFSET HW +6dq+8msF
MOV AH, 09H y8jwfO3
INT 21H 0q6$KP}q
MOV AX, 4C00H a o"\L0;{
INT 21H VKI`@rY4
END @w?y;W!a>
_ISIq3A?
wjLtLtK?
x86 CPU,GNU/Linux,NASM Tw^b!74gq
;"Hello World" for Linux on Intel 80x86 using nasm (Intel syntax). ?];?3X~|
;Enter this into "hello.asm" then type: /G}TPXA
;"nasm -f elf hello.asm" /l o;:)AiP
;"ld hello.o -o hello" ?)x"+[2
;"./hello" hzG+s#
>NL4&MV:
section .data ;data section declaration b#ih=qE
msg db 'Hello World!',0AH $\:;N]Cs~0
len equ $-msg ;string length BhJag L ^o
W!@*3U]2R
section .text ;code section declaration 3zdm-5R.b
global _start ;entry point (start of execution) %kB84dE
_start: mov edx,len ;string length }@R*U0*E
mov ecx,msg ;string start l_ Eeus
mov ebx,1 ;file handle: stdout (MfPu8j
mov eax,4 ;sys_write Qq,w6ekr
int 80h ;kernel system call B.O &