“Hello, World!”程序是一个只在计算机屏幕上打印出“Hello, World!”(英语,意为“世界,你好!”)字串的计算机程序。该程序通常是计算机程序设计语言的初学者所要学习编写的第一个程序。它还可以用来确定该语言的编译器、程序开发环境以及运行环境已经正确安装。 "RIZV
0'nikLaKy
将Hello World程序作为第一个学写的程序,现在已经成为一种传统。该程序最早出现在由Brian Kernighan和Dennis Ritchie写的计算机程序设计教程《C语言程序设计》。 tHLrhH<w
&/,|+U[
以下是用不同语言写成的Hello World程序的几个例子: \9-"M;R.d
Ada !!Z?[rj
with Ada.Text_Io; use Ada.Text_Io; dz Zb
procedure Hello is @k&qb!Qah
begin GfC5z n>
Put_Line ("Hello, world!"); =B.F;40
end Hello; j65<8svl
!A48TgAeE
]qhPd_$?D'
汇编语言 Sna4wkbS
}1IpON
x86 CPU,DOS,TASM `({T]@]V
MODEL SMALL hB{jUP)";
IDEAL K\|FQ^#UYm
STACK 100H Ar~"R4!
H#ClIh?'b
DATASEG L5MzLE&~
HW DB 'Hello, world!$' T0]MuIJ).
_V`DWR
*
CODESEG JU&+c6>
MOV AX, @data ~i 7^P9
MOV DS, AX 0Won9P
MOV DX, OFFSET HW QY= = GfHt
MOV AH, 09H Y3Q9=u*5
INT 21H $ImrOf^qt
MOV AX, 4C00H 4`,j =3
INT 21H .bio7c6
END 1^gl}^|B
7`u$
y(
y8+ZT
x86 CPU,GNU/Linux,NASM B#9{-t3Vf
;"Hello World" for Linux on Intel 80x86 using nasm (Intel syntax). ?IpLf\n-
;Enter this into "hello.asm" then type: &r:7g%{n
;"nasm -f elf hello.asm" /Z7iLq~t"G
;"ld hello.o -o hello" ;J7F J3n
;"./hello" {z|;Xi::"
.`&F>o(A
section .data ;data section declaration 0wS+++n$5
msg db 'Hello World!',0AH K(aJi,e>
len equ $-msg ;string length L@fY$Rw
O#I1V K
section .text ;code section declaration z;y:9l
global _start ;entry point (start of execution) 3po:xMY
_start: mov edx,len ;string length |fo0
mov ecx,msg ;string start 5eWwgA
mov ebx,1 ;file handle: stdout B$Kn1 k
mov eax,4 ;sys_write "yW:\
int 80h ;kernel system call p)+k=b
cph:y
mov ebx,0 ;return value NFv>B>
mov eax,1 ;sys_exit n'emNRa
int 80h ;kernel system call }\C-}
Q
&\_iOw8
9?k_y ZV
x86 CPU,Windows,MASM32 uG<}N=
.386 Vx-7\NB
.model flat,stdcall D+>1]ij
option casemap:none 0iJue&
;Include 文件定义 |ZQ@fmvL/p
include windows.inc tor!Dl@Mo
include user32.inc aM;W$1h
includelib user32.lib /7
Cn(s5 o
include kernel32.inc Q%f|~Kl-hd
includelib kernel32.lib <