“Hello, World!”程序是一个只在计算机屏幕上打印出“Hello, World!”(英语,意为“世界,你好!”)字串的计算机程序。该程序通常是计算机程序设计语言的初学者所要学习编写的第一个程序。它还可以用来确定该语言的编译器、程序开发环境以及运行环境已经正确安装。 m+?$cyA>v
|08b=aR6ro
将Hello World程序作为第一个学写的程序,现在已经成为一种传统。该程序最早出现在由Brian Kernighan和Dennis Ritchie写的计算机程序设计教程《C语言程序设计》。 wJ,l"bnq
IH(]RHTp%
以下是用不同语言写成的Hello World程序的几个例子: h mC.5mY
Ada nd_+g2x'
with Ada.Text_Io; use Ada.Text_Io; ?Imq4I~)
procedure Hello is |=&[sC
begin f*)8bZDD
Put_Line ("Hello, world!"); 8vpB(VxV+
end Hello; 2#%@j6
{]-AuC2E/0
jrJ!A(<)
汇编语言 G0*>S`:4
ebsZ
x86 CPU,DOS,TASM rWsUWA T*
MODEL SMALL >|Yr14?7
IDEAL PWUS@I
STACK 100H \JjZ _R
U?]}K S;6
DATASEG 3msb"|DG
HW DB 'Hello, world!$' Vcjmj
{HoeK>rd
CODESEG XLQt>y)
MOV AX, @data L{PH8Xl_
MOV DS, AX UaA1HZ1
MOV DX, OFFSET HW ?D[9-K4Vn
MOV AH, 09H W5a7HkM
INT 21H ,,
S]_S
MOV AX, 4C00H iR(=<>
INT 21H \;#T.@c5
END GS_+KR\
.: dy d
`hpX 97v
x86 CPU,GNU/Linux,NASM olLVT<
;"Hello World" for Linux on Intel 80x86 using nasm (Intel syntax). aUZh_<@
;Enter this into "hello.asm" then type: *n]f) Jc
;"nasm -f elf hello.asm" _`|te|ccF
;"ld hello.o -o hello" LeP;HP|
;"./hello" 5ub|r0&M
kxvzAKz~
section .data ;data section declaration IZ2(F,{o
msg db 'Hello World!',0AH ^qR2 !fwm<
len equ $-msg ;string length -/)>DOgUq
XWd;-%`<
section .text ;code section declaration HgY [Q}7s
global _start ;entry point (start of execution) o*5iHa(Qm
_start: mov edx,len ;string length Dt]N&E#\D
mov ecx,msg ;string start ZsnFuk#W
mov ebx,1 ;file handle: stdout
}.DE521u
mov eax,4 ;sys_write &d,!^9
int 80h ;kernel system call *Rx&