“Hello, World!”程序是一个只在计算机屏幕上打印出“Hello, World!”(英语,意为“世界,你好!”)字串的计算机程序。该程序通常是计算机程序设计语言的初学者所要学习编写的第一个程序。它还可以用来确定该语言的编译器、程序开发环境以及运行环境已经正确安装。 .+>w0FG.
Jfa=#`
将Hello World程序作为第一个学写的程序,现在已经成为一种传统。该程序最早出现在由Brian Kernighan和Dennis Ritchie写的计算机程序设计教程《C语言程序设计》。 JL $6Fw;
\o !
以下是用不同语言写成的Hello World程序的几个例子: _6" vPN
Ada Pc>$[kT0
with Ada.Text_Io; use Ada.Text_Io; r)Ts(#Z
procedure Hello is O%5cMz?eU
begin sv\'XarM
Put_Line ("Hello, world!"); :zfnp,Gv
end Hello; v#&r3ZW0
0fA42*s;
]#R'hL%f
汇编语言 ^@ s!"c
:J]S+tQ)
x86 CPU,DOS,TASM +Q_(wR"FS
MODEL SMALL =Xze ).g
IDEAL # m?GBr%k
STACK 100H W[PZQCL}K)
@Tb
T
DATASEG :0IxnK(r&
HW DB 'Hello, world!$' _'<V<OjVM!
tk"L2t
CODESEG ;KJJK#j
MOV AX, @data { 6Lkh
MOV DS, AX [:sP Z{
MOV DX, OFFSET HW L>+g;GJ
MOV AH, 09H J XKps#,(#
INT 21H ##d\|r
MOV AX, 4C00H 4NN-'Z>a
INT 21H ms'&.u&<
END =o\:@I[
c_clpMx=
v'i"Q
x86 CPU,GNU/Linux,NASM LqIMU4Ex
;"Hello World" for Linux on Intel 80x86 using nasm (Intel syntax). !+Z"7e
nj
;Enter this into "hello.asm" then type: ANtp7ad
;"nasm -f elf hello.asm" sj a;NL
;"ld hello.o -o hello" J7$1+|"
;"./hello" u /!U/|
5EDHJU>
section .data ;data section declaration 6i[\?7O'0
msg db 'Hello World!',0AH QT{$2 7;
len equ $-msg ;string length GlP
[:
S_LY>k?
section .text ;code section declaration dVc;Tt
global _start ;entry point (start of execution) q# gZ\V$I
_start: mov edx,len ;string length oc'#sE
mov ecx,msg ;string start HRIf)n&~f
mov ebx,1 ;file handle: stdout *V#v6r7<Y/
mov eax,4 ;sys_write UXD?gK1
int 80h ;kernel system call W=M&U
^(m`5]qr7J
mov ebx,0 ;return value /{ YUM~
mov eax,1 ;sys_exit >0)E\_ u
int 80h ;kernel system call @v_E'
9QG^
w8:F^{
W>
.O"Ri
x86 CPU,Windows,MASM32 idnn%iO
.386 &:=
.model flat,stdcall Gp9>R~$
option casemap:none o O%!P<