《各种语言的HelloWorld编程》由会员分享,可在线阅读,更多相关《各种语言的HelloWorld编程(16页珍藏版)》请在金锄头文库上搜索。
1、hello world百科名片C和C+“hello world”程序hello world作为所有编程语言的起始阶段,占据着无法改变的地位,所有中/英/法/德/美版本的编程教材中,hello world总是作为第一个TEST记录于书本之中,所有的编程第一步就在于此了!经典之中的经典!hello world!目录简介AKA 控制台:传统图形界面应用开发工具:基于web图形用户界面:展开编辑本段简介这个例程是从Kernighan & Ritchie 合著的The C Programme Language开始有的,因为它的简洁,实用,并包含了一个程序所应具有的一切,因此为后来的些类书的作者提供了范例
2、,一直待续到今。我们刚开始接触计算机语言大多从Hello world 开始,下面是各种语言的Hello world program:as400的RPGLE语言:D Vc_Hello s 100AC Eval Vc_Hello = Hello World!C DSPLY Vc_Hello编辑本段AKA 控制台:ABC语言的Hello World程序WHILE (1=1) :WRITE Hello World Ada语言的Hello World程序with Ada.Text_Io; use Ada.Text_Io;procedure Hello isbeginPut_Line (Hello, wo
3、rld!);end Hello;AmigaE语言的Hello World程序PROC main()WriteF(Hello, World!)ENDPROCAPL语言的Hello World程序Hello WorldAssembly语言的Hello World程序Accumulator-only architecture: DEC PDP-8, PAL-III assemblerSee the Example section of the PDP-8 article.Accumulator + index register machine: MOS 6502, CBM, ca65 asmMSG:
4、 .ASCIIZ Hello, world!LDX #0LDA MSG,X ; load initial charLP: JSR $FFD2 ; CHROUT CBM KERNALINXLDA MSG,XBNE LPRTSAccumulator/Index microcoded machine: Data General Nova, RDOSSee the example section of the Nova article.Expanded accumulator machine: Intel x86, MS-DOS, TASMMODEL SMALLIDEALSTACK 100HDATAS
5、EG语言的Hello World程序MSG DB Hello, world!$CODESEG语言的Hello World程序MOV AX, dataMOV DS, AXMOV DX, OFFSET MSGMOV AH, 09H ; DOS: output ASCII$ stringINT 21HMOV AX, 4C00HINT 21HENDGeneral-purpose-register CISC: DEC PDP-11, RT-11, MACRO-11.MCALL .REGDEF,.TTYOUT,.EXIT.REGDEFHELLO: MOV #MSG,R1MOVB (R1),R0LOOP:
6、.TTYOUTMOVB +(R1),R0BNE LOOP.EXITMSG: .ASCIZ /HELLO, WORLD!/.END HELLOCISC: VAX, VMS, MACRO32.title helloterm_name: .ascid /SYS$INPUT/term_chan: .blkw 1out_iosb: .blkq 1msg: .asciz /Hello, world!/.entry start,0; establish a channel for terminal I/O$assign_s devnam=term_name,-chan=term_chanblbc r0,er
7、ror; queue the I/O request$qio_s chan=term_chan,-func=#io$_writevblk,-iosb=out_iosb,-p1=msg,-p2=#13blbc r0,error$exit_s ; normal exiterror: halt ; error condition.end startAWK语言的Hello World程序BEGIN print Hello, world! BASIC语言的Hello World程序PRINT HELLO WORLDMS BASIC语言的Hello World程序(traditional, unstruc
8、tured)10 PRINT Hello, world!20 ENDTI-BASIC语言的Hello World程序isp Hello, world!Structured BASIC语言的Hello World程序print Hello, world!BCPL语言的Hello World程序GET LIBHDRLET START () BE$(WRITES (Hello, world!*N)$)BF语言的Hello World程序+.+.+.+.+.+.-.-.+.C语言的Hello World程序#include int main(void)printf(Hello, world!n);C+
9、语言的Hello World程序#include using namespace std;int main()cout Hello, world! io:fwrite(Hello, world!n).Forth语言的Hello World程序. Hello, world! CRFortran语言的Hello World程序PROGRAM HELLOWRITE(*,10)10 FORMAT(Hello, world!)STOPENDHaskell语言的Hello World程序module HelloWorld (main) wheremain = putStr Hello WorldnIpts
10、crae语言的Hello World程序ON ENTER Hello, World! & SAYJava语言的Hello World程序public class Examplepublic static void main(String args) System.out.println(Hello, world!);Logo语言的Hello World程序print hello world!Lua语言的Hello World程序print Hello, world!MIXAL语言的Hello World程序TERM EQU 19 the MIX console device numberORI
11、G 1000 start addressSTART OUT MSG(TERM) output data at address MSGHLT halt executionMSG ALF MIXALALF HELLALF O WORALF LD END START end of the programMSDOS batch语言的Hello World程序echo offecho Hello, world!OCaml语言的Hello World程序let _ =print_endline Hello world!;OPLPROC hello:PRINT Hello, WorldENDPPascal语言的Hello World程序