hello world 为什么我们看到学习中有这一句话!!!
Hello World ,中文意思:你好,世界。世界上的第一个程序就是Hello World,由Brian Kernighan创作。
Hello, world"程序是指在计算机屏幕上输出“Hello,world”这行字符串的计算机程序,“hello, world”的中文意思是“世界,你好”。这个例程在Brian Kernighan 和Dennis M. Ritchie合著的《The C Programme Language》使用而广泛流行。因为它的简洁,实用,并包含了一个该版本的C程序首次出现在1974年Brian Kernighan所撰写的《Programming in C: A Tutorial》
printf("hello,world\n");
实际上将“Hello”和“World”一起使用的程序最早出现于1972年,出现在贝尔实验室成员Brian Kernighan撰写的内部技术文件《Introduction to the Language B》之中:
main(){ extern a,b,c; putchar(a);putchar(b);putchar(c);putchar('!*n'); } a'hell'; b'o,w'; c'orld';
我们刚开始接触计算机语言大多从Hello world 开始,下面是各种语言的Hello world program:
AAuto
import win;//导入窗口支持库 import console;//导入控制台支持库 //两个斜杠开始表示注释语句:在控制台显示信息 console.log("Hello,world!"); //弹出一个消息对话框 win.msgbox("Hello,world!","我的第一个程序") //关闭控制台 console.close();
ActionScript 3
package{ import flash.display.Sprite; public class Main extends Sprite{ public function Main(){ trace("Hello,World"); } } }
Ada
with Ada.Text_Io;useAda.Text_Io; procedureHellois begin Put_Line("Hello,world!"); endHello;
AmigaE
PROCmain() WriteF('Hello,World!') ENDPROC
APL
'HelloWorld'
ASP
<%response.write "Hello,world!"%>
D语言
import std.stdio; int main(char[][]args) { writefln(" Hello World !"); return0; }
汇编
Accumulator-only architecture: DEC PDP-8, PAL-III assembler
See the Example section of the PDP-8 article.
Accumulator + index register machine: MOS 6502, CBM, ca65 asm
MSG:.ASCIIZ"Hello,world!" LDX#0 LDAMSG,X;loadinitialchar @LP:JSR$FFD2;CHROUTCBMKERNAL INX LDAMSG,X BNE@LP RTS Accumulator/Indexmicrocodedmachine:DataGeneralNova,RDOS SeetheexamplesectionoftheNovaarticle. Expandedaccumulatormachine:Intelx86,MS-DOS,TASM MODELSMALL IDEAL STACK100H DATASEG MSGDB'Hello,world!$' CODESEG MOVAX,@data MOVDS,AX MOVDX,OFFSETMSG MOVAH,09H;DOS:outputASCII$string INT21H MOVAX,4C00H INT21H END
General-purpose-register CISC: DECPDP-11, RT-11, MACRO-11
.MCALL.REGDEF,.TTYOUT,.EXIT .REGDEF HELLO:MOV#MSG,R1 MOVB(R1),R0 LOOP:.TTYOUT MOVB+(R1),R0 BNELOOP .EXIT MSG:.ASCIZ/HELLO,WORLD!/ .ENDHELLO CISC:VAX,VMS,MACRO32 .titlehello term_name:.ascid/SYS$INPUT/ term_chan:.blkw1 out_iosb:.blkq1 msg:.asciz/Hello,world!/ .entrystart,0 ;establishachannelforterminalI/O $assign_sdevnam=term_name,- chan=term_chan blbcr0,error ;queuetheI/Orequest $qio_schan=term_chan,- func=#io$_writevblk,- iosb=out_iosb,- p1=msg,- p2=#13 blbcr0,error $exit_s;normalexit error:halt;errorcondition .endstart
AWK
BEGIN{print"Hello,world!"}
BASIC
PRINT"HELLOWORLD"
MS BASIC
(traditional, unstructured)
PRINT"Hello,world!" END
TI-BASIC
isp"Hello,world!"
Structured BASIC
print"Hello,world!"
BCPL
GET"LIBHDR" LETSTART()BE $( WRITES("Hello,world!*N") $)
BF
++++++++++[>+++++++>++++++++++>+++>+<<<<-] >++.>+.+++++++..+++.>++.<<+++++++++++++++. >.+++.------.--------.>+.>.
C/C++
int main(void) { puts("HelloWorld"); return 0; }
C
#include <stdio.h> int main(void) { printf("Hello,world!\n"); return 0; }
C++
#include <stdlib.h> #include <iostream> using namespace std; int main() { cout << "Hello,world!" << endl; system("pause"); return 0; }
C#
using System; class HelloWorldApp { public static void Main(string[] args) { Console.WriteLine("Helloworld!"); Console.Read(); } }
Clean
modulehello Start::String Start="Hello,world"
CLIST
PROC 0
WRITE Hello, World!
COBOL
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
DISPLAY "Hello, world!".
STOP RUN.
Common Lisp
(format t "Hello world!~%")
Eiffel
class HELLO_WORLD
creation
make
feature
make is
local
io:BASIC_IO
do
!!io
io.put_string("%N Hello, world!")
end -- make
end -- class HELLO_WORLD
Erlang
-module(hello).
-export([hello_world/0]).
hello_world() -> io:fwrite("Hello, world!\n").
Forth
." Hello, world!" CR
Fortran
PROGRAMHELLO WRITE(*,10) 10FORMAT('Hello,world!') STOP END
Google Go
package main
import "fmt"
func main() {
fmt.Println("Hello, world!")
}
Haskell
module HelloWorld (main) where
main = putStr "Hello World\n"
Iptscrae
ON ENTER {
"Hello, " "World!" & SAY
}
Java
public class HelloWorld{ public static void main(String[] args){ System.out.println("HelloWorld!"); } }
JavaScript
(function(){ alert("HelloWorld!"); }) ();
KL
operator entry ()
{
report("hello, world")
}
LOGO
PR "HELLO,WORLD
Lua
print"Hello,world!"
MIXAL
TERM EQU 19 the MIX console device number
ORIG 1000 start address
START OUT MSG(TERM) output data at address MSG
HLT halt execution
MSG ALF "MIXAL"
ALF " HELL"
ALF "O WOR"
ALF "LD "
END START end of the program
MSDOS batch
@echo hello world
@pause
OCaml
let _ =
print_endline "Hello world!";;
OPL
PROC hello:
PRINT "Hello, World"
ENDP
Objective-C
#import <Foundation/Foundation.h> int main(int argc, const char* argv[]) { @autoreleasepool{ NSLog(@"Hello,World!"); } return0; }
Pascal
programhello_world; begin writeln('HelloWorld!'); end.
Perl
print "Hello, world!\n";
PHP
<?php print("Hello,world!"); ?>
或者:
<?php echo"Hello,world!"; ?>
Pike
#!/usr/local/bin/pike intmain(){ write("Hello,world!\n"); return0; }
PL/I
Test: procedure options(main);
declare My_String char(20) varying initialize('Hello, world!');
put skip list(My_String);
end Test;
Python
#3.0以下版本:
print"Hello,world!"
#3.0及其以上版本:
print('Hello,world')
REXX
alsoNetRexxand Object REXX
say "Hello, world!"
Ruby
print"Hello,world!\n"
RPGLE
D Vc_Hello s 100A
C Eval Vc_Hello = 'Hello World!'
C DSPLY Vc_Hello
Sather
class HELLO_WORLD is
main is
#OUT+"Hello World\n";
end;
end;
Scheme
(display "Hello, world!")
(newline)
Sed
(requires at least one line of input)
sed -ne '1s/.*/Hello, world!/p'
Self
'Hello, World!' uppercase print.
Smalltalk
Transcript show: 'Hello, world!'
SML
print "Hello, world!\n";
SNOBOL
OUTPUT = "Hello, world!"
END
SQL
数据库操作版
create table MESSAGE(TEXT char(15)); insert into MESSAGE(TEXT) values('Hello,world!'); select TEXT from MESSAGE; drop table MESSAGE;
简单版
print'Hello,World.'
StarOffice Basic
sub main
print "Hello, World"
end sub
swift
println("Hello,world")
Tcl
puts "Hello, world!"
Turing
put "Hello, world!"
UNIX-style shell
echo 'Hello, world!'
Romanian pseudocode
(UBB Cluj-Napoca)Algoritmul Salut este:
fie s:="Hello, world";
tipareste s;
sf-Salut
重来没有接触过,零基础学习软件编程,一个字累