hello world程序集锦

hello world作为所有编程语言的起始阶段,占据着无法改变的地位,所有中/英/法/德/美……版本的编程教材中,hello world总是作为第一个TEST记录于书本之中,所有的编程第一步就在于此了!经典之中的经典!

hello world!

"Hello, world"程序是指在计算机屏幕上输出Hello, world这行字符串的计算机程序,“hello, world”的中文意思是“世界,你好”。这个例程在Brian Kernighan和Dennis M. Ritchie合著的The C Programming Language中被使用而广泛流行。因为它的简洁、实用,并包含了一个程序所应具有的一切,因此为后来的编程类图书的作者提供了范例,一直待续到今。

hello world程序全集

ActionScript

trace("Hello, world!");

Ada

with TEXT_IO;

procedure HELLO is
begin
 TEXT_IO.PUT_LINE ("Hello, world!");
end HELLO;

汇编语言

x86 CPU,GNU/Linux,NASM

 

section .data
 msg  db  'Hello, world!',0xA
 len  equ  $-msg

 section .text
 global _start
 _start:
  mov  edx,len
  mov  ecx,msg
  mov  ebx,1
  mov  eax,4
  int  0x80

  mov  ebx,0
  mov  eax,1
  int  0x80

x86 AT&T、Gas

.data
 msg : .string "Hello, world!\n"
 len = . - msg
.text
.global _start

_start:
 movl $len, %edx
 movl $msg, %ecx
 movl $1 , %ebx
 movl $4 , %eax
 int $0x80

 movl $0 , %ebx
 movl $1 , %eax
 int $0x80

x86 CPU、Windows、MASM32

 .386
 .model flat,stdcall
 option casemap:none
;==========================================================
include  windows.inc
include  user32.inc
includelib user32.lib
include  kernel32.inc
includelib kernel32.lib
;==========================================================
 .data
szCaption db "A MessageBox!", 0
szText db "Hello, world!", 0
;==========================================================
 .code
start:
invoke MessageBox, NULL, addr szText, addr szCaption, MB_OK
invoke ExitProcess, NULL
;==========================================================
end start

8086操作系统

[BITS 16]
org 0x7c00
 mov ax,cs
 mov ds,ax
 mov es,ax
 call DispStr
 jmp $;End Hear
DispStr:
 mov ax, BootMessage
 mov bp, ax
 mov cx, 16;How long is the String
 mov ax, 0x1301
 mov bx, 0x000c
 mov dl, 0
 int 0x10
 ret
BootMessage: db "Hello, world!"
times 510-($-$$) db 0x0
dw 0xaa55; Bootable Mark

ASP

<% Response.Write("Hello, world!") %>

或者简单地写成:

<%= "Hello, world!" %>

AutoIt

MsgBox(1,'','Hello, world!')

      

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/1615.html