各种程序语言的Hello World程序

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
ret
}
26. OCaml
print_endline "Hello world!";;
27. OPL
PROC hell
PRINT "Hello, World"
ENDP
28. oz
functor $
import
Application
System
end
18. Haskell
module HelloWorld (main) where
main = putStr "Hello World!\n"
19. Icon
procedure main()
write("Hello World!\n")
end
20. INTERCAL
.method public static void main() il managed
{
.entrypoint
.maxstack 1
ldstr "Hello World!\n"
call void [mscorlib]System.Console::Write(class System.String)
return -1;
}
31. PL/I
Test: procedure options(main);
declare My_String char(20) varying initialize(\'Hello, world!\');
put skip list(My_String);
#include <windows.h>
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
{
public void windowClosing(WindowEvent wet)
{
System.exit(0);
}
});
}
}
23. Lua
print "Hello World!\n"
24. MIXAL
TERM EQU 19 the MIX console device number
do
!!io
io.put_string("%N Hello World!")
end -- make
end -- class HELLO_WORLD
15. Erlang
-module(hello).
21. Iptscrae
ON ENTER {
"Hello, " "World!" & SAY
}
22. Java
// 命令行界面:
class Hello
{
public static void main(String ars[])
{
System.out.print("Hello World!\n");
DO ,1 SUB #8 <- #248
DO ,1 SUB #9 <- #168
DO ,1 SUB #10 <- #24
DO ,1 SUB #11 <- #16
DO ,1 SUB #12 <- #158
DO ,1 SUB #13 <- #52
PLEASE READ OUT ,1
PLEASE GIVE UP
35. Python
print "Hello World!"
36. Rexx
say "Hello, world!"
37. Ruby
print "Hello World!\n"
38. Sather
class HELLO_WORLD is
main is
#OUT+"Hello World\n";
各种语言的Hello World程序
1. Ada
with Ada.Text_IO;
procedure Hello is
begin
Ada.Text_IO.Put_Line("Hello World!");
end Hello;
2. ALGOL68
\'begin\'
print("Hello World!")
DATA DIVISION.
PROCEDURE DIVISION.
DISPLAY "Hello World!".
STOP RUN.
12. Common Lisp
(format t "Hello world!")
13. D
import std.c.stdio;
int main(char[][] args)
\font\HW=cmr10 scaled 3000
\leftline{\HW Hello world}
\bye
47. Turing
put "Hello, world!"
48. VB
sub main
msgbox "Hello World!"
end sub
49. VC++
Transcript show: \'Hello, world!\'
43. SML
print "Hello, world!\n";
44. SNOBOL
OUTPUT = "Hello, world!"
END
45. TCL
puts "Hello World!"
46. TeX
$)
6. Boo
import System
Console.WriteLine("Hello World!")
7. Brainfuck
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<
+++++++++++++++.>.+++.------.--------.>+.>.
PLEASE DO ,1 <- #13
DO ,1 SUB #1 <- #238
DO ,1 SUB #2 <- #112
DO ,1 SUB #3 <- #112
DO ,1 SUB #4 <- #0
DO ,1 SUB #5 <- #64
DO ,1 SUB #6 <- #238
DO ,1 SUB #7 <- #26
end;
end;
39. Scheme
(display "Hello, world!\n")
40. sed
sed -ne \'1s/.*/Hello, world!/p\'
41. Self
\'Hello, World!\' uppercase print.
42. Smalltalk
define
{System.print \'Hello World!\'}
{Application.exit 0}
end
29. Pascal
program Hello;
begin
writeln(\'Hello, world!\');
end.
Perl
print "Hello World\n"
{
printf("Hello World!\n");
return 0;
}
14. Eiffel
class HELLO_WORLD
creation
make
feature
make is
local
iBASIC_IO
return 0;
}
10. Clean
module hello
Start :: String
Start = "Hello, world"
11. COBOL
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
ENVIRONMENT DIVISION.
MSGBOX "Hello World!"
END FUNCTION
34. Prolog
predicates
Hello
clauses
Hell-
write("Hello World!\n"). %或write("Hello World!"),nl.
goal Hello.
30. Pike
//命令行界面
int main()
{
write("Hello, world!\n");
return 0;
}
//图形界面
int main()
{
GTK.setup_gtk();
GTK.Alert("Hello World!")
->signal_connect("destroy", lambda(){ exit(0); });
-export([hello_world/0]).
hello_world() -> ifwrite("Hello World!\n").
16. Forth
." Hello World!" CR
17.Байду номын сангаасFortran
program Hello
write(*,*) \'Hello World!\'
\'end\'
3. AmigaE
PROC main()
WriteF(\'Hello World!\')
ENDPROC
4. awk
BEGIN { print "Hello, world!" }
5. BCPL
GET "LIBHDR"
LET START () BE
$(
WRITES ("Hello, world!*N")
Label lbl=new Label("Hello World!");
Hello.setTitle("Hello World");
Hello.setSize(300,200);
Hello.setBackground(new Color(224,224,224));
Hello.add(lbl);
end Test;
32. PostScript
/font /Courier findfont 24 scalefont
font setfont
100 100 moveto
(Hello world!) show
showpage
33. PowerBASIC
#COMPILE EXE
FUNCTION PBMAIN () AS LONG
}
}
// 图形界面:
import java.awt.*;
import java.awt.event.*;
class HelloWorld extends Frame
{
public static void main(String args[])
{
HelloWorld Hello=new HelloWorld();
lbl.setAlignment(1);
lbl.setFont(new Font("Arial",Font.PLAIN,24));
Hello.setLocation(260,180);
Hello.show();
Hello.addWindowListener(new WindowAdapter()
ALF " HELL"
ALF "O WOR"
ALF "LD "
END START end of the program
25. MSIL
.assembly Hello
{
.ver 1:0:0:0
}
ORIG 1000 start address
START OUT MSG(TERM) output data at address MSG
HLT halt execution
MSG ALF "MIXAL"
8. C
#include <stdio.h>
int main()
{
printf("Hello World!\n");
return 0;
}
9. C++
#include <iostream.h>
int main()
{
cout<<"Hello World!"<<endl;
相关文档
最新文档