“Hello, World!”程序是一个只在计算机屏幕上打印出“Hello, World!”(英语,意为“世界,你好!”)字串的计算机程序。该程序通常是计算机程序设计语言的初学者所要学习编写的第一个程序。它还可以用来确定该语言的编译器、程序开发环境以及运行环境已经正确安装。 }Hz-h4Z
vSYKe
将Hello World程序作为第一个学写的程序,现在已经成为一种传统。该程序最早出现在由Brian Kernighan和Dennis Ritchie写的计算机程序设计教程《C语言程序设计》。 RW7oL:$dt
;x-H$OZX
以下是用不同语言写成的Hello World程序的几个例子: c,q"}nE8w
Ada 9"aFS=><
with Ada.Text_Io; use Ada.Text_Io; q{GSsDo-:V
procedure Hello is >C3NtGvy
begin }E5#X R
Put_Line ("Hello, world!"); =u8D!AxT
end Hello; (a}
T@|l@xm~L
5)yOw|Bd
汇编语言 P;[Y42\z|
]&:b<]K3
x86 CPU,DOS,TASM 3l%,D:
?
MODEL SMALL (.1 rtj
IDEAL ahtYSz_FM
STACK 100H um jhG6
3u*hTT
DATASEG ~pevU`}Uqc
HW DB 'Hello, world!$' xb>n&ym?
L"foL
CODESEG ole|J
MOV AX, @data YN@6}B#1
MOV DS, AX rer|k<k;]G
MOV DX, OFFSET HW @ EmGexLPM
MOV AH, 09H T;!ukGoFP
INT 21H ]G0dS
Fh{j
MOV AX, 4C00H h}|6VJ@.
INT 21H P>Q{He:
END C]'g:93L
#%^\\|'z
f]8!DXEA
x86 CPU,GNU/Linux,NASM W7L+8LU;
;"Hello World" for Linux on Intel 80x86 using nasm (Intel syntax). uuSR%KK]|
;Enter this into "hello.asm" then type: H#L#2M%
;"nasm -f elf hello.asm" S<nP80C
;"ld hello.o -o hello" 0/\PZX+
;"./hello" 2QGMe}
A XBkJ'jd
section .data ;data section declaration 5Lsm_"0
msg db 'Hello World!',0AH gF[6c`-s
len equ $-msg ;string length k&)K(
R-pH Quu3
section .text ;code section declaration dL_QX,X-]
global _start ;entry point (start of execution) h2wN<