“Hello, World!”程序是一个只在计算机屏幕上打印出“Hello, World!”(英语,意为“世界,你好!”)字串的计算机程序。该程序通常是计算机程序设计语言的初学者所要学习编写的第一个程序。它还可以用来确定该语言的编译器、程序开发环境以及运行环境已经正确安装。 V1nqEdhk
%>zG;4
将Hello World程序作为第一个学写的程序,现在已经成为一种传统。该程序最早出现在由Brian Kernighan和Dennis Ritchie写的计算机程序设计教程《C语言程序设计》。 )2d1@]6#
%2'4h(Oq^
以下是用不同语言写成的Hello World程序的几个例子: AGwdM-$iT
Ada _a$5"
with Ada.Text_Io; use Ada.Text_Io; pox;NdX7
procedure Hello is SMB&sl
begin [zP}G?(
Put_Line ("Hello, world!"); LoJEchRK
end Hello; r
da: ~
.;bU["fn)
b/T k$&
汇编语言 pXQ$n:e
(yEU9R$I"
x86 CPU,DOS,TASM 71<4q{n
MODEL SMALL X?r$o>db
IDEAL e&(Wn2)o
STACK 100H qgWsf-di=
if1)AE-
DATASEG Mz)
r'
HW DB 'Hello, world!$' +WR'\15u
:zfMRg
CODESEG
VyIJ)F.c
MOV AX, @data K-.%1d@$y
MOV DS, AX 8<6@O
MOV DX, OFFSET HW d[;&2Jz*
MOV AH, 09H %[L/JJbP&Z
INT 21H ??hKsjNAm0
MOV AX, 4C00H I&1.}{G>F
INT 21H i(# Fjp
END {~\:4
r|bGn#^
Ka)aBU9
x86 CPU,GNU/Linux,NASM 1csbuR?
;"Hello World" for Linux on Intel 80x86 using nasm (Intel syntax). RWDPsZC
;Enter this into "hello.asm" then type: H-m).^
;"nasm -f elf hello.asm" JNvgUb'U
;"ld hello.o -o hello" B/~ubw
;"./hello" Gh3f^PWnc
%vG;'_gMB
section .data ;data section declaration YD~(l-?"
msg db 'Hello World!',0AH ^h`rA"F\
len equ $-msg ;string length Hp(41Eb,
}LWrtmc
section .text ;code section declaration :.-KM7tDI1
global _start ;entry point (start of execution) L&5zr_
_start: mov edx,len ;string length yRhD<