“Hello, World!”程序是一个只在计算机屏幕上打印出“Hello, World!”(英语,意为“世界,你好!”)字串的计算机程序。该程序通常是计算机程序设计语言的初学者所要学习编写的第一个程序。它还可以用来确定该语言的编译器、程序开发环境以及运行环境已经正确安装。 s=:LS
_-{=Z=?6}
将Hello World程序作为第一个学写的程序,现在已经成为一种传统。该程序最早出现在由Brian Kernighan和Dennis Ritchie写的计算机程序设计教程《C语言程序设计》。 %/\sn<6C}
G2n.NW#d4
以下是用不同语言写成的Hello World程序的几个例子: 5FB3w48
Ada yMkR)HY
with Ada.Text_Io; use Ada.Text_Io; -@w}}BR
procedure Hello is Cz5U
begin KRd'!bG=1
Put_Line ("Hello, world!"); gIRZ kT`
end Hello; 4@F8-V3q4
]==7P;_-
K~-V([tWg
汇编语言 2 7dS.6
$aT '~|?
x86 CPU,DOS,TASM &
\5Ur^t
MODEL SMALL u&={hJ&7
IDEAL
>_]Ov:5
STACK 100H # ^,8JRA
9_svtO ]P
DATASEG @S~n^v,)
HW DB 'Hello, world!$' F&7Z(
J<"Z6 '0v
CODESEG &a\w+
MOV AX, @data Zd-QZ<c";t
MOV DS, AX 3zfiegY@wm
MOV DX, OFFSET HW ?G9DSk?6%Z
MOV AH, 09H gL|
9hvHr[
INT 21H 01
+#2~S
MOV AX, 4C00H ".AW
INT 21H @$p6w
END d5
]-{+V+
"IJ1b~j?
&l`_D?{<#
x86 CPU,GNU/Linux,NASM :ba4E[@
;"Hello World" for Linux on Intel 80x86 using nasm (Intel syntax). I
WT|dA >
;Enter this into "hello.asm" then type: .3XSF$;
;"nasm -f elf hello.asm" 07(LLhk@d
;"ld hello.o -o hello" t=:5?}J.Q$
;"./hello" -;
d{}F
7?_gm>]a
section .data ;data section declaration k&K'FaM!
msg db 'Hello World!',0AH K",Xe>
len equ $-msg ;string length v'`qn
%,S:^Rvv
section .text ;code section declaration (IHR {m
global _start ;entry point (start of execution) 8&+u+@H
_start: mov edx,len ;string length :*l\j"fX5
mov ecx,msg ;string start tmoclK-
mov ebx,1 ;file handle: stdout -c0*
mov eax,4 ;sys_write xjxX4_
int 80h ;kernel system call KF#qz2S
if1)AE-
mov ebx,0 ;return value "f3mi[
mov eax,1 ;sys_exit h{~GzrL*
int 80h ;kernel system call g[ @Q iy
D7thLqA
$_a/!)bP
x86 CPU,Windows,MASM32 Xk/:a}-l
.386 j:48l[;ed
.model flat,stdcall mMu+MXTk<
option casemap:none IK4(r /
;Include 文件定义 1!+0]_8K
include windows.inc 3$_- 0>
include user32.inc X,8Zn06M
includelib user32.lib Y!(w. G
include kernel32.inc IY}GU 2#
includelib kernel32.lib %6V=G5+W
;数据段 3-0jxx(
.data n0':6*oGW
szCaption db 'A MessageBox!',0 :IsJE6r
szText db 'Hello,world!',0 $b_~
;代码段 YD~(l-?"
.code &d!ASa
start: Hp(41Eb,
invoke MessageBox,NULL,offset szText,offset szCaption,MB_OK :q2RgZE
invoke ExitProcess,NULL :.-KM7tDI1
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> L&5zr_
end start yRhD<