文档章节

各种语言的Hello World程序 選擇學習的

電泡泡
 電泡泡
发布于 2012/12/18 22:51
字数 2728
阅读 395
收藏 16


選擇學習語言的參考
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!")
\'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")
$)


6. Boo
import System
Console.WriteLine("Hello World!")


7. Brainfuck
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<
+++++++++++++++.>.+++.------.--------.>+.>.


8. C
#include <stdio.h>
int main()
{
    printf("Hello World!\n");
    return 0;
}


9. C++
#include <iostream.h>
int main()
{
    cout<<"Hello World!"<<endl;
    return 0;
}


10. Clean
module hello
Start :: String
Start = "Hello, world"


11. COBOL
IDENTIFICATION DIVISION.
PROGRAM-ID.     HELLO-WORLD.


ENVIRONMENT DIVISION.


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)
{
    printf("Hello World!\n");
    return 0;
}


14. Eiffel
class HELLO_WORLD
    creation
        make
    feature
        make is
        local
                iBASIC_IO
        do
                !!io
                io.put_string("%N Hello World!")
        end -- make
end -- class HELLO_WORLD


15. Erlang
-module(hello).
-export([hello_world/0]).
hello_world() -> ifwrite("Hello World!\n").


16. Forth
." Hello World!" CR


17. Fortran
program Hello
write(*,*) \'Hello World!\'
end


18. Haskell
module HelloWorld (main) where
main = putStr "Hello World!\n"


19. Icon
procedure main()
    write("Hello World!\n")
end


20. INTERCAL
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
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


21. Iptscrae
ON ENTER {
    "Hello, " "World!" & SAY
}


22. Java
// 命令行界面:
class Hello
{
    public static void main(String ars[])
    {
        System.out.print("Hello World!\n");
    }
}


// 图形界面:
import java.awt.*;
import java.awt.event.*;
class HelloWorld extends Frame

public static void main(String args[])
{
  HelloWorld Hello=new HelloWorld();
  Label lbl=new Label("Hello World!");
  Hello.setTitle("Hello World");
  Hello.setSize(300,200);
  Hello.setBackground(new Color(224,224,224));
  Hello.add(lbl);
  lbl.setAlignment(1);
  lbl.setFont(new Font("Arial",Font.PLAIN,24));
  Hello.setLocation(260,180);
  Hello.show();
  Hello.addWindowListener(new WindowAdapter()
  {
   public void windowClosing(WindowEvent wet)
   {
    System.exit(0);
   }
  });
}
}


23. Lua
print "Hello World!\n"


24. 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


25. MSIL
.assembly Hello

.ver 1:0:0:0

.method public static void main() il managed  

.entrypoint
.maxstack 1
ldstr "Hello World!\n" 
call void [mscorlib]System.Console::Write(class System.String) 
ret
}


26. OCaml
print_endline "Hello world!";; 


27. OPL
PROC hell
    PRINT "Hello, World"
ENDP 


28. oz
functor $
import
    Application
    System
define
    {System.print \'Hello World!\'}
    {Application.exit 0}
end


29. Pascal
program Hello;
begin
    writeln(\'Hello, world!\');
end. 


Perl
print "Hello World\n"


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); });
  return -1;
}


31. PL/I
Test: procedure options(main);
    declare My_String char(20) varying initialize(\'Hello, world!\');
    put skip list(My_String);
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
    MSGBOX "Hello World!"
END FUNCTION


34.  Prolog
predicates
Hello
clauses
Hell-
write("Hello World!\n").         %或write("Hello World!"),nl.
goal Hello.


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"; 
    end; 
end;


39. Scheme
(display "Hello, world!\n")


40. sed
sed -ne \'1s/.*/Hello, world!/p\'


41. Self
\'Hello, World!\' uppercase print.


42. Smalltalk
Transcript show: \'Hello, world!\'


43. SML
print "Hello, world!\n";


44. SNOBOL
    OUTPUT = "Hello, world!"
END


45. TCL
puts "Hello World!"


46. TeX
\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++
#include <windows.h>
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
HWND hwnd;
MSG Msg;
WNDCLASS wndclass;
char lpszClassName[]="Window";
char lpszTitle[]="Hello World";
wndclass.style=0;
wndclass.lpfnWndProc=WndProc;
wndclass.cbClsExtra=0;
wndclass.cbWndExtra=0;
wndclass.hInstance=hInstance;
wndclass.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wndclass.hCursor=LoadCursor(NULL,IDC_ARROW);
wndclass.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName=NULL;
wndclass.lpszClassName=lpszClassName;
if(!RegisterClass(&wndclass))
{
  MessageBeep(0);
  return FALSE;
}
hwnd=CreateWindow(lpszClassName,
                lpszTitle,
       WS_OVERLAPPEDWINDOW,
       CW_USEDEFAULT,
       CW_USEDEFAULT,
       CW_USEDEFAULT,
       CW_USEDEFAULT,
       NULL,
       NULL,
       hInstance,
       NULL);
ShowWindow(hwnd,nCmdShow);
UpdateWindow(hwnd);
while(GetMessage(&Msg,NULL,0,0))
{
  TranslateMessage(&Msg);
  DispatchMessage(&Msg);
}
return Msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
PAINTSTRUCT ps;
    HDC hdc;
char Hello[]="Hello World!";
tch(message)
{
case WM_PAINT:
  hdc = BeginPaint(hwnd, &ps);
  TextOut(hdc, 0, 0, Hello,lstrlen(Hello));
  EndPaint(hwnd, &ps);
  break;
case WM_DESTROY:
  PostQuitMessage(0);
  break;
default:
  return DefWindowProc(hwnd,message,wParam,lParam);
}
return 0;
}


50. Win32汇编
;图形界面Hello World
      .386
      .model flat, stdcall
      option casemap :none
      include \masm32\include\windows.inc
      include \masm32\include\user32.inc
      include \masm32\include\kernel32.inc
      includelib \masm32\lib\user32.lib
      includelib \masm32\lib\kernel32.lib
    .code
start:
    jmp @F
      szDlgTitle    db "Hello World(汇编语言版)",0
      szMsg         db "Hello World!",0
    @@:
    push MB_OK
    push offset szDlgTitle
    push offset szMsg
    push 0
    call MessageBox
    push 0
    call ExitProcess
end start


51. 汇编
   .MODEL small
   .STACK 100h
   .DATA
Hello DB \'Hello World!\',13,10,\'$\'
   .CODE
   mov  ax, @data
   mov  ds,ax                  
   mov  ah,9                   
   mov  dx,OFFSET Hello        
   int  21h                    
   mov  ah,4ch                
   int  21h                  
   END


52. ASP
response.write "Hello World!"


53. C#
using System;
class Hello
{
    public static void Main()
    {
        Console.WriteLine("Hello World!");
    }
}


54. FOXBASE
? "Hello World!"


@0 ,0 say "Hello World!"


55. Groovy
print "Hello World!\n"


56. PHP
echo "Hello World!"




--------------------------------------------------------------------------------
 


VB .MET:
imports System
module Hello
    sub main()
        Console.WriteLine("Hello World!")
    end sub
end module




JScript:
import System;
Console.Write("Hello World!\n");


          或


print("Hello World!"); 
--------------------------------------------------------------------------------
 




易语言:
标准输出 (, “Hello World!”)
          
          或


信息框 (“Hello World!”, 0, )


--------------------------------------------------------------------------------
 




Delphi:
program HelloWorld;
uses
    Dialogs;
begin
    ShowMessage(\'Hello, World!\');
end.


DOS Batch:
@echo Hello World!


UNIX Shell
echo \'Hello World!\'


--------------------------------------------------------------------------------
 




一个没有main方法的Java版Hello World程序:


class Hello
{
    static 
    {
        System.out.println("Hello World!");
        System.exit(0);
    }
}




--------------------------------------------------------------------------------
 




Xaml:
<Canvas 
xmlns="http://schemas.microsoft.com/2003/xaml" 
Background="LightCyan" 
Width="100%" Height="100%">
<Text Canvas.Left="90" Canvas.Top="20" FontSize="36">Hello World!</Text>
</Canvas>


SQL:
print \'Hello World!\'


SML:
print "Hello World!\n";;


另一个版本的标准C++:
%:include <iostream>
using namespace std;
void main()
<%
    cout<<"Hello World!"<<endl;
%>


C99风格:
_pragma (c9x, on)
#include <stdio.h>
int main (void)
{
    printf ( "Hello, world " );
    return 0;
}


--------------------------------------------------------------------------------
 
我编写的不用输出函数的C语言版Hello World程序:
void main()
{
    int far *x;
    x=(int far*)0xb8000000;
    *x++=0x0e48;
    *x++=0x0e65;
    *x++=0x0e6c;
    *x++=0x0e6c;
    *x++=0x0e6f;
    *x++=0x0e20;
    *x++=0x0e57;
    *x++=0x0e6f;
    *x++=0x0e72;
    *x++=0x0e6c;
    *x++=0x0e64;
    *x++=0x0e21;

--------------------------------------------------------------------------------
 
C语言的10种Hello World程序:


#include <stdio.h>
void main()
{
    printf("Hello World!\n");
}


#include <conio.h>
void main()
{
    textcolor(14);
    cprintf("Hello World!\r\n");
}


#include <stdio.h>
void main()
{
    puts("Hello World!");
}


#include <stdio.h>
void main()
{
    putchar(\'H\');
    putchar(\'e\');
    putchar(\'l\');
    putchar(\'l\');
    putchar(\'o\');
    putchar(\' \');
    putchar(\'W\');
    putchar(\'o\');
    putchar(\'r\');
    putchar(\'l\');
    putchar(\'d\');
    putchar(\'!\');
    putchar(\'\n\');
}


#include <stdio.h>
void main()
{
    fprintf(stdout,"Hello World!\n");
}


#include <stdio.h>
void main()
{
    fputs("Hello World!\n",stdout);
}


#include <stdio.h>
void main()
{
    fwrite("Hello World!\n",sizeof("Hello World!"),1,stdout);
}


#include <stdio.h>
void main()
{
    putc(\'H\',stdout);
    putc(\'e\',stdout);
    putc(\'l\',stdout);
    putc(\'l\',stdout);
    putc(\'o\',stdout);
    putc(\' \',stdout);
    putc(\'W\',stdout);
    putc(\'o\',stdout);
    putc(\'r\',stdout);
    putc(\'l\',stdout);
    putc(\'d\',stdout);
    putc(\'!\',stdout);
    putc(\'\n\',stdout);
}


#include <conio.h>
void main()
{
    textcolor(10);
    putch(\'H\');
    putch(\'e\');
    putch(\'l\');
    putch(\'l\');
    putch(\'o\');
    putch(\' \');
    putch(\'W\');
    putch(\'o\');
    putch(\'r\');
    putch(\'l\');
    putch(\'d\');
    putch(\'!\');
    putch(\'\r\');
    putch(\'\n\');
}


#include <conio.h>
void main()
{
    puttext(1,1,12,1,"H\7e\7l\7l\7o\7 \7W\7o\7r\7l\7d\7!\7");
}


--------------------------------------------------------------------------------
 
Heron:
program HelloWorld;
functions
{
    _main()
    {
        print_string("Hello, world!");
    }
}
End




Scala:
object HelloWorld with Application
{
    Console.println("Hello, world!");
}




SPARK:
with Spark_IO;
--# inherit Spark_IO;
--# main_program;
procedure Hello_World
--# global in out Spark_IO.Outputs;
--# derives Spark_IO.Outputs from Spark_IO.Outputs;
is
begin
   Spark_IO.Put_Line (Spark_IO.Standard_Output, "Hello World!", 0);
end Hello_World;




--------------------------------------------------------------------------------
 




PureBASIC:
OpenConsole()
PrintN("Hello World!")
CloseConsole()


            或


MessageRequester("PureBASIC - Hello", "Hello World!", 0)




MediaBASIC:
sub Main()
    Console
    WriteConsole("Hello World!")
end sub


         或


sub Main()
    ShowMessage "Hello World!"
end sub


XPB! BASIC:
Console
PROGRAM
    print "Hello World!"


Liberty BASIC:
print "Hello World!"


ScriptBASIC:
print "Hello World!" & chr(13) & chr(10)




blassic:
print "Hello World!"


KBASIC:
Print "Hello World!"




Chipmunk BASIC:
print "Hello World!"




BBC BASIC:
PRINT "Hello World!"




--------------------------------------------------------------------------------
 
Modula-2
MODULE Hello;
FROM Terminal2 IMPORT WriteLn; WriteString;
BEGIN
   WriteString("Hello, world!");
   WriteLn;
END Hello;


Oberon
MODULE Hello;
       IMPORT Oberon, Texts;
VAR W: Texts.Writer;
PROCEDURE World*;
BEGIN
    Texts.WriteString(W, "Hello World!");
    Texts.WriteLn(W);
    Texts.Append(Oberon.Log, W.buf)
END World;
BEGIN
    Texts.OpenWriter(W)
END Hello.




--------------------------------------------------------------------------------
 
另一个版本的C++:
#include <iostream>
using namespace std;
int main(int argc,char *argv[])
{
    cout<<"Hello World!\n";
    return 0;

--------------------------------------------------------------------------------
 


VC++ .NET
#include <stdafx.h>
#using <mscorlib.dll>
using namespace System;
int main()
{
Console::Write("Hello World!\n");
return 0;

--------------------------------------------------------------------------------
 
VJ# .NET
package JHello;
public class Hello
{
    public static void main(String[] args)
    {
        System.out.print("Hello World!\n");


    }
}


--------------------------------------------------------------------------------
 

using System;
class Hello
{
    public static void Main(string[] args)
    {
        Console.Write("Hello World!\n");
    }

--------------------------------------------------------------------------------
 
BLISS:
%TITLE \'HELLO_WORLD\'
MODULE HELLO_WORLD (IDENT=\'V1.0\', MAIN=HELLO_WORLD,
        ADDRESSING_MODE (EXTERNAL=GENERAL)) =
BEGIN
    LIBRARY \'SYS$LIBRARY:STARLET\';
    EXTERNAL ROUTINE
       LIB$PUT_OUTPUT;
GLOBAL ROUTINE HELLO_WORLD =
BEGIN
    LIB$PUT_OUTPUT(%ASCID %STRING(\'Hello World!\'))
END;
END
ELUDOM 
--------------------------------------------------------------------------------
 
SPARK
with Spark_IO;
--# inherit Spark_IO;
--# main_program;
procedure Hello_World
--# global in out Spark_IO.Outputs;
--# derives Spark_IO.Outputs from Spark_IO.Outputs;
is
begin
   Spark_IO.Put_Line (Spark_IO.Standard_Output, "Hello World!", 0);
end Hello_World; 
--------------------------------------------------------------------------------
 
Gambas
PUBLIC SUB Main()
    Print "Hello World!"
END


--------------------------------------------------------------------------------
 
Expanded accumulator machine: Intel x86, Linux, GAS 
.data
msg:
.ascii "Hello, world!\n"
len = . - msg
.text
    .global _start
_start:
movl $len,%edx
movl $msg,%ecx
movl ,%ebx
movl ,%eax
int x80
movl ,%ebx
movl ,%eax
int x80


--------------------------------------------------------------------------------
 
General-purpose-register CISC: DEC PDP-11, RT-11, MACRO-11 
  .MCALL  .REGDEF,.TTYOUT,.EXIT
          .REGDEF


   HELL  MOV    #MSG,R1
           MOVB   (R1),R0
   LOOP:  .TTYOUT
           MOVB  +(R1),R0
           BNE    LOOP
          .EXIT


   MSG:   .ASCIZ  /HELLO, WORLD!/
          .END    HELLO


--------------------------------------------------------------------------------
 
CISC on advanced multiprocessing OS: DEC VAX, VMS, MACRO-32 
           .title    hello


           .psect    data, wrt, noexe


   chan:   .blkw     1
   iosb:   .blkq     1
   term:   .ascid    "SYS$OUTPUT"
   msg:    .ascii    "Hello, world!"
   len =   . - msg


           .psect    code, nowrt, exe


           .entry    hello, ^m<>


           ; Establish a channel for terminal I/O
           $assign_s devnam=term, -
                     chan=chan
           blbc      r0, end


           ; Queue the I/O request
           $qiow_s   chan=chan, -
                     func=#io$_writevblk, -
                     iosb=iosb, -
                     p1=msg, -
                     p2=#len


           ; Check the status and the IOSB status
           blbc      r0, end
           movzwl    iosb, r0


           ; Return to operating system
   end:    ret


          .end       hello 
--------------------------------------------------------------------------------
 
RISC processor: ARM, RISC OS, BBC BASIC\'s in-line assembler 
  .program         
           ADR R0,message
           "OS_Write0"
           "OS_Exit"
  .message         
           DCS "Hello, world!"
           DCB 0
           ALIGN
or the even smaller version (from qUE); 


          "OS_WriteS":EQUS"Hello, world!":EQUB0:ALIGN:MOVPC,R14




--------------------------------------------------------------------------------
 
TI-BASIC 
On TI-80-TI-86 calculators. 
:Disp "Hello, world!"


On TI-89/TI-92 calculators. 
   :HelloWorld()
   :Prgm
   :Disp "Hello, world!"
   :EndPrgm




--------------------------------------------------------------------------------
 
Commodore BASIC (unstructured)
   10 ?"Hello, world!"
   20 END 
--------------------------------------------------------------------------------
 


DCL batch 
   $ write sys$output "Hello, world!"


--------------------------------------------------------------------------------
 
Ed and Ex (Ed extended) 
   a
   hello world!
   .
   p
or like s 


   echo -e \'a\nhello world!\n.\np\'|ed
   echo -e \'a\nhello world!\n.\np\'|ex




--------------------------------------------------------------------------------
 
EUPHORIA 
   puts(1, "Hello, world!")


--------------------------------------------------------------------------------
 


Forte TOOL 
   begin TOOL HelloWorld;


   includes Framework;
   HAS PROPERTY IsLibrary = FALSE;


   forward  Hello;


   -- START CLASS DEFINITIONS


   class Hello inherits from Framework.Object


   has public  method Init;


   has property
       shared=(allow=off, override=on);
       transactional=(allow=off, override=on);
       monitored=(allow=off, override=on);
       distributed=(allow=off, override=on);


   end class;
   -- END CLASS DEFINITIONS


   -- START METHOD DEFINITIONS


   ------------------------------------------------------------
   method Hello.Init
   begin
   super.Init();


   task.Part.LogMgr.PutLine(\'HelloWorld!\');
   end method;
   -- END METHOD DEFINITIONS
   HAS PROPERTY
       CompatibilityLevel = 0;
       ProjectType = APPLICATION;
       Restricted = FALSE;
       MultiThreaded = TRUE;
       Internal = FALSE;
       LibraryName = \'hellowor\';
       StartingMethod = (class = Hello, method = Init);


   end HelloWorld;


--------------------------------------------------------------------------------
 


Frink 
   println["Hello, world!"]


--------------------------------------------------------------------------------
 
Game Maker 
In the draw event of some object: 


   draw_text(x,y,"Hello World");




--------------------------------------------------------------------------------
 
HP-41 & HP-42S 
(Handheld Hewlett-Packard RPN-based alphanumeric engineering calculators.) 




   01 LBLTHELLO
   02 THELLO, WORLD
   03 PROMPT




--------------------------------------------------------------------------------
 
Io 
   "Hello world!" print
or 


   write("Hello world!\n")




--------------------------------------------------------------------------------
 
JVM 
(disassembler output of javap -c Hello.class) 


   public class Hello extends java.lang.Object {
       public Hello();
       public static void main(java.lang.String[]);
   }


   Method Hello()
      0 aload_0
      1 invokespecial #1 <Method java.lang.Object()>
      4 return


   Method void main(java.lang.String[])
      0 getstatic #2 <Field java.io.PrintStream out>
      3 ldc #3 <String "Hello, world!">
      5 invokevirtual #4 <Method void println(java.lang.String)>
      8 return




--------------------------------------------------------------------------------
 
kogut
   WriteLine "Hello, world!"


--------------------------------------------------------------------------------
 
MUF 
   : main
     me @ "Hello, world!" notify
   ; 
--------------------------------------------------------------------------------
 
POV-Ray 
#include "colors.inc"
camera {
   location <3, 1, -10>
   look_at <3,0,0>
}
light_source { <500,500,-1000> White }
text {
   ttf "timrom.ttf" "Hello world!" 1, 0
   pigment { White }
}


--------------------------------------------------------------------------------
 


Processing 
println("Hello world!"); 
--------------------------------------------------------------------------------
 
RPL 
See also GUI section. 


(On Hewlett-Packard HP-28, HP-48 and HP-49 series graphing calculators.) 


   <<
     CLLCD
     "Hello, World!" 1 DISP
     0 WAIT
     DROP
   >>




--------------------------------------------------------------------------------
 
 


XHTML 1.1 
(Using UTF-8 character set.) 


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  <head>
    <title>Hello, world!</title>
  </head>
  <body>
    <p>Hello, world!</p>
  </body>
</html>




--------------------------------------------------------------------------------
 
XUL 
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <box align="center"> <label value="Hello, world!" /> </box> </window> 


--------------------------------------------------------------------------------
 
LaTeX 
\documentclass
\begin
  Hello, world!
\end


--------------------------------------------------------------------------------
 
Ruby with WxWidgets 
See also TUI section. 


require \'wxruby\'


class HelloWorldApp < Wx::App
def on_init
  ourFrame = Wx::Frame.new(nil, -1, "Hello, world!").show
  ourDialogBox = Wx::MessageDialog.new(ourFrame, "Hello, world!", "Information:", Wx::OK|Wx::ICON_INFORMATION).show_modal
end
end


HelloWorldApp.new.main_loop




--------------------------------------------------------------------------------
 
SWT 
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Label;


public class SWTHello {
    public static void main (String [] args) {
        Display display = new Display ();
        final Shell shell = new Shell(display);
        RowLayout layout = new RowLayout();
        layout.justify = true;
        layout.pack = true;
        shell.setLayout(layout);
        shell.setText("Hello, World!");
        Label label = new Label(shell, SWT.CENTER);
        label.setText("Hello, World!");
        shell.pack();
        shell.open ();
        while (!shell.isDisposed ()) {
            if (!display.readAndDispatch ()) display.sleep ();
        }
        display.dispose ();
    }
}




--------------------------------------------------------------------------------
 
RTML 
Hello ()
TEXT "Hello, world!"


--------------------------------------------------------------------------------
 
Qt toolkit (in C++) 
   #include <qapplication.h>
   #include <qpushbutton.h>
   #include <qwidget.h>
   #include <iostream>


   class HelloWorld : public QWidget
   {
       Q_OBJECT


   public:
       HelloWorld();
       virtual ~HelloWorld();
   public slots:
       void handleButtonClicked();
       QPushButton *mPushButton;
   };


   HelloWorld::HelloWorld() :
       QWidget(),
       mPushButton(new QPushButton("Hello, World!", this))
   {
       connect(mPushButton, SIGNAL(clicked()), this, SLOT(handleButtonClicked()));
   }


   HelloWorld::~HelloWorld() {}


   void HelloWorld::handleButtonClicked()
   {
       std::cout << "Hello, World!" << std::endl;
   }


   int main(int argc, char *argv[])
   {
       QApplication app(argc, argv);
       HelloWorld helloWorld;
       app.setMainWidget(&helloWorld);
       helloWorld.show();
       return app.exec();
   }


--------------------------------------------------------------------------------
 
又一个Java 版的Hello World:


   import javaxng.JOptionPane;


   public class Hello {
       public static void main(String[] args) {
           JOptionPane.showMessageDialog(null, "Hello, world!");
           System.exit(0);
       }
   }




--------------------------------------------------------------------------------
 
GTK 2.x (in Euphoria) 
   include gtk2/wrapper.e


   Info(NULL,"Hello","Hello World!")
--------------------------------------------------------------------------------
 
GTK# (in C#) 
using Gtk;
using GtkSharp;
using System;


class Hello {


        static void Main()
        {
                Application.Init ();


                Window window = new Window ("helloworld");
                window.Show();


                Application.Run ();


        }
}


--------------------------------------------------------------------------------
 
GTK toolkit (in C++) 
   #include <iostream>
   #include <gtkmm/main.h>
   #include <gtkmm/button.h>
   #include <gtkmm/window.h>
   using namespace std;


   class HelloWorld : public Gtk::Window {
   public:
     HelloWorld();
     virtual ~HelloWorld();
   protected:
     Gtk::Button m_button;
     virtual void on_button_clicked();
   };


   HelloWorld::HelloWorld()
   : m_button("Hello, world!") {
       set_border_width(10);
       m_button.signal_clicked().connect(SigC::slot(*this,
                                         &HelloWorld::on_button_clicked));
       add(m_button);
       m_button.show();
   }


   HelloWorld::~HelloWorld() {}


   void HelloWorld::on_button_clicked() {
       cout << "Hello, world!" << endl;
   }


   int main (int argc, char *argv[]) {
       Gtk::Main kit(argc, argv);
       HelloWorld helloworld;
       Gtk::Main::run(helloworld);
       return 0;
   }


--------------------------------------------------------------------------------
 
Cocoa or GNUStep (In Objective C)
  #import <Cocoa/Cocoa.h>
  @interface hello : NSObject {
  }
  @end
  
  @implementation hello
  
  -(void)awakeFromNib
  { 
       NSBeep(); // we don\'t need this but it\'s conventional to beep when you show an alert
       NSRunAlertPanel(@"Message from your Computer", @"Hello, world!", @"Hi!", nil, nil);
  }
  
  @end


--------------------------------------------------------------------------------
 
TACL 
   #OUTPUT Hello, world!


--------------------------------------------------------------------------------
 


STARLET 
   RACINE: HELLO_WORLD.


   NOTIONS:
   HELLO_WORLD : ecrire("Hello, world!").


--------------------------------------------------------------------------------
 
POV-Ray 
#include "colors.inc"
camera {
   location <3, 1, -10>
   look_at <3,0,0>
}
light_source { <500,500,-1000> White }
text {
   ttf "timrom.ttf" "Hello world!" 1, 0
   pigment { White }
}


--------------------------------------------------------------------------------
 
OPS5 
   (object-class request
            ^action)


   (startup
      (strategy MEA)
      (make request ^action hello)
   )




   (rule hello
      (request ^action hello)
      -->
        (write |Hello World!| (crlf))
   ) 
--------------------------------------------------------------------------------
 
Malbolge 
   (=<`:9876Z4321UT.-Q+*)M\'&%$H"!~}|Bzy?=|/.zHGwEDCBA@98\6543W10/.R,+O< 
--------------------------------------------------------------------------------
 
第一代COCO语言
import COCO.System;
class Hello : StdApp
{
    object con:@CUI.Console;
    method Main(args:string[] $val):int $public
    {
        con.put("Hello World!\m");
        return 0;
    }
}
 






© 著作权归作者所有

電泡泡
粉丝 23
博文 183
码字总数 69717
作品 0
衡阳
私信 提问
加载中

评论(8)

Ryan-瑞恩
Ryan-瑞恩

引用来自“電泡泡”的评论

引用来自“Rayn-瑞恩”的评论

引用来自“電泡泡”的评论

引用来自“Rayn-瑞恩”的评论

有的语言风格很相似啊。

確實 思路都差不多

恩,,,,,其实我想说,,编程语言之间的设计有抄袭

站在巨人的肩膀上才能看的更高

呵呵,,,,你说的有道理!支持。
電泡泡
電泡泡 博主

引用来自“Rayn-瑞恩”的评论

引用来自“電泡泡”的评论

引用来自“Rayn-瑞恩”的评论

有的语言风格很相似啊。

確實 思路都差不多

恩,,,,,其实我想说,,编程语言之间的设计有抄袭

站在巨人的肩膀上才能看的更高
Ryan-瑞恩
Ryan-瑞恩

引用来自“電泡泡”的评论

引用来自“Rayn-瑞恩”的评论

有的语言风格很相似啊。

確實 思路都差不多

恩,,,,,其实我想说,,编程语言之间的设计有抄袭
電泡泡
電泡泡 博主

引用来自“Rayn-瑞恩”的评论

有的语言风格很相似啊。

確實 思路都差不多
Ryan-瑞恩
Ryan-瑞恩
有的语言风格很相似啊。
寒川
寒川

引用来自“午后冬日”的评论

那个Brainfuck语法果然很操蛋

这语言翻译过来叫啥?
爪哇小贩
爪哇小贩
那个Brainfuck语法果然很操蛋
慢慢变成大叔
第7个碉堡了
你的第一个PhoneGap应用:Hello Inside!

PhoneGap是一個跨平台行動開發解決方案,它把行動網頁的介面包成像原生軟體一樣,在先前本站的Richard曾專文介紹過:請參閱:跨越行動網頁與原生軟體的隔閡 – PhoneGap,其中談到的例子是以...

无鸯
2011/09/09
3.1K
2
我要成为前端工程师!给 JavaScript 新手的建议与学习资源整理

来源于:http://blog.miniasp.com/post/2016/02/02/JavaScript-novice-advice-and-learning-resources.aspx 今年有越來越多企業開始跟我們接洽企業內訓的事,想請我幫他們培訓前端工程師,但...

一个勤奋的胖子
2017/01/04
0
0
XMind/FreeMind-心智圖的妙用

转载:http://www.cc.ntu.edu.tw/chinese/epaper/0009/200906209004.htm 作者:張文瀞 / 臺灣大學計算機及資訊網路中心程式設計組 如何能幫助記憶,減少背書時間,輕鬆的做規劃,花些時間畫張...

shengfq
2013/03/25
276
0
比特幣,我根本不想跟你談它是否是通縮的

假設A是比特幣的擁護者。 原因很簡單,我根本就不承認它是貨幣,對我來説沒有任何價值,儘管、或許、假如對A來説有價值。 由於我跟A沒有共同的討論基本面,跟A討論起來完全浪費我的生命。 货...

碎__了
2014/01/12
0
0
[教程]iPhone 實機開發 Part 1 - HelloWorld

[教程]iPhone 實機開發 Part 1 - HelloWorld

林宝基
2012/07/10
260
0

没有更多内容

加载失败,请刷新页面

加载更多

Yum命令即将灭亡,快来一起拥抱DNF

一、基本介绍 DNF是Dandified yum的缩写,DNF三个字母却没有一个来自Yum。DNF也是基于RPM的包管理工具,其首先在Fedora系统中出现,已经成为Fedora系统的默认的包管理工具。 CentOS8启用了D...

听风的小猪
6分钟前
5
0
HashMap的实现原理

HashMap的实现原理,一句话概括下:HashMap底层是一个数组,数组的每个元素是一个链表。 下面为HashMap构造函数的源码: public HashMap(int initialCapacity, float loadFactor) {//初...

水木星辰
13分钟前
11
0
如何在悬停而不是单击时使Twitter Bootstrap菜单下拉列表

问题: I'd like to have my Bootstrap menu automatically drop down on hover, rather than having to click the menu title. 我想让我的Bootstrap菜单在悬停时自动下拉,而不必单击菜单标......

javail
18分钟前
11
0
Binomial

题目:https://www.codewars.com/kata/540d0fdd3b6532e5c3000b5b/ 主要思路是提取系数 a和系数b,以及指数e。然后使用二项式定理计算每一项的系数,最后将结果转换成字符串。 在转换过程中,...

reter
23分钟前
10
0
老白学编程 - “autotools” 的实例分析-netdata

概述 学了几天autotool系列的知识, 找个实际项目, 对照着分析一下,由于知识有限,不知道能深入到什么程度, 期待。 Netdata Netdata是个监控软件,做的很不错, "秒级"是他的一个特色,详...

机械猿
27分钟前
8
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部