“Hello, World!”程序是一个只在计算机屏幕上打印出“Hello, World!”(英语,意为“世界,你好!”)字串的计算机程序。该程序通常是计算机程序设计语言的初学者所要学习编写的第一个程序。它还可以用来确定该语言的编译器、程序开发环境以及运行环境已经正确安装。 Pn}oSCo
ciPq@kMV
将Hello World程序作为第一个学写的程序,现在已经成为一种传统。该程序最早出现在由Brian Kernighan和Dennis Ritchie写的计算机程序设计教程《C语言程序设计》。 FlH=Pqc
p|)j{nc
以下是用不同语言写成的Hello World程序的几个例子: /'>ck2drjk
Ada HN&]`cr;
with Ada.Text_Io; use Ada.Text_Io; o107. s
procedure Hello is $fW8S8
begin 1!ijRr
Put_Line ("Hello, world!"); .m%ygoO
end Hello; TfNm0=|
0gKSjTqo
~Z97L
汇编语言 MG,?,1_ &
t$uj( y>
x86 CPU,DOS,TASM OF(tCK
MODEL SMALL W%#LHluP
IDEAL M;0\fUh;
STACK 100H %BkPkQA
C9`x"$
DATASEG 5PKdMEK|q
HW DB 'Hello, world!$' E{B40E~4
=XUt?5
CODESEG q0_Pl*
MOV AX, @data wH qbTA
MOV DS, AX YtT:\#D
MOV DX, OFFSET HW tlmfDQD
MOV AH, 09H `?(9Bl
INT 21H $0;Dk,
MOV AX, 4C00H +]#pm9
INT 21H e]l.m!,r
END {y>Kcfc/?E
Biy$p6
`lE8dwL
x86 CPU,GNU/Linux,NASM 1uc;:N G=
;"Hello World" for Linux on Intel 80x86 using nasm (Intel syntax). @|7e~U
;Enter this into "hello.asm" then type: S#Pni}JD
;"nasm -f elf hello.asm" !2=eau^p
;"ld hello.o -o hello" .iEzEmu
;"./hello" Io)@u~yz
MSS0Sx<f
section .data ;data section declaration !r_2b! dy
msg db 'Hello World!',0AH J|o )c~
len equ $-msg ;string length R<8!lQ4s
OQsF$%*
section .text ;code section declaration ^/Frg<>'p
global _start ;entry point (start of execution) GEfTs[
_start: mov edx,len ;string length WcE/,<^*
mov ecx,msg ;string start N1z:9=(I
mov ebx,1 ;file handle: stdout Bf6\KI<