“Hello, World!”程序是一个只在计算机屏幕上打印出“Hello, World!”(英语,意为“世界,你好!”)字串的计算机程序。该程序通常是计算机程序设计语言的初学者所要学习编写的第一个程序。它还可以用来确定该语言的编译器、程序开发环境以及运行环境已经正确安装。 UiQF4Uc"
KvY1bMU!
将Hello World程序作为第一个学写的程序,现在已经成为一种传统。该程序最早出现在由Brian Kernighan和Dennis Ritchie写的计算机程序设计教程《C语言程序设计》。 |f{(MMlj
Aq;WQyZ2
以下是用不同语言写成的Hello World程序的几个例子: u#)ARCx ,w
Ada 5fY7[{2
with Ada.Text_Io; use Ada.Text_Io; w42=tN+B
procedure Hello is nh*hw[Ord
begin ;i-<dAV8B
Put_Line ("Hello, world!"); 0dCg/wJx
end Hello; 0 HPqoen$
*IQQsfL)
uy rS6e0
汇编语言 ?.Lq`~T`
@&9 ,0x
x86 CPU,DOS,TASM k] iyx
MODEL SMALL _"h1#E
IDEAL R
"qt}4m
STACK 100H /pQUu(~h_
K9QC$b9(
DATASEG ^SWV!rrg
HW DB 'Hello, world!$' EYSBC",
kK_9I (7c
CODESEG bsv!z\}
MOV AX, @data sUz,F8G
MOV DS, AX ,w%hD*
MOV DX, OFFSET HW 5bo')^xa
MOV AH, 09H E-v^eMWX
INT 21H w`X0^<Fv
MOV AX, 4C00H P2g}G4qf
INT 21H Aa}Nr5{O|
END =^mBj?(V7
]PQ6 em
CPci
'SO
x86 CPU,GNU/Linux,NASM vVf%wei^#
;"Hello World" for Linux on Intel 80x86 using nasm (Intel syntax). FJ] ?45
;Enter this into "hello.asm" then type: Q?V'3ZZF!
;"nasm -f elf hello.asm" v,Uu)Z
;"ld hello.o -o hello" v~:'t\n
;"./hello" #n.XOet<\
\pVNJy$`<
section .data ;data section declaration 4uE|$
msg db 'Hello World!',0AH TT^L)d
len equ $-msg ;string length \{.c0
"L+NN|
section .text ;code section declaration q$kx/6=k
global _start ;entry point (start of execution) "{x+ \Z\
_start: mov edx,len ;string length PYyT#AcW2
mov ecx,msg ;string start gB])@O%/
mov ebx,1 ;file handle: stdout u9j1>QU
mov eax,4 ;sys_write yX%NFXD
int 80h ;kernel system call $_O;yz
r#NR3_@9
mov ebx,0 ;return value q"VC#97`
mov eax,1 ;sys_exit |Ge!;v
int 80h ;kernel system call G2w0r,[
]23+ d/
d,E2l~s
x86 CPU,Windows,MASM32
C:p`
.386 "0m\y+%8
.model flat,stdcall (l}nwyh5
option casemap:none 4[rX\?^e
;Include 文件定义 WO=P~F<