See also ebooksgratis.com: no banners, no cookies, totally FREE.

CLASSICISTRANIERI HOME PAGE - YOUTUBE CHANNEL
Privacy Policy Cookie Policy Terms and Conditions
Hello world - Wikipedia

Hello world

Da Wikipedia, l'enciclopedia libera.

Hello, world! (in italiano "Ciao, mondo!"), è un termine riferibile all'informatica: è infatti la scritta stampata a video dal primo programma di esempio scritto in linguaggio C all'inizio del famoso libro "Programmare in C" di Brian Kernighan e Dennis Ritchie (vi è anche una versione, molto controversa, secondo la quale il primo esempio noto fu scritto diverso tempo prima e in linguaggio BCPL).

Il programma, semplicissimo, non fa nient'altro che stampare sul video questa scritta ed è stato ripreso nella didattica di molti altri linguaggi come primo esempio di introduzione al linguaggio in esame, diventando un vero classico: molto spesso, un programmatore che vuole imparare un nuovo linguaggio inizia i suoi esercizi provando a scrivere un programma che stampi a video "Hello, world!" in quel linguaggio.

Da notare che la versione corrente non è quella originale: in principio era solo "hello, world", senza maiuscola e punto esclamativo, che sono entrati nella tradizione solo in seguito.

Indice

[modifica] Console

[modifica] ABAP

   write 'Hello World!'. 


[modifica] Ada

with Ada.Text_IO;
 
procedure Hello is
 begin
   Ada.Text_IO.Put_Line ("Hello World!");
end Hello;

[modifica] ALGOL

   'BEGIN'
       OUTSTRING(2,'('HELLO, WORLD')');
   'END'

[modifica] APL

   'Hello, World!'

[modifica] ASP 3.0

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

Versione breve:

<%= "Hello, World!" %>

[modifica] Assembly (x86 CPU, DOS, TASM syntax)

   IDEAL
   MODEL SMALL
   STACK 100h
   DATASEG
       HW      DB      "hello, world", 13, 10, '$'
   CODESEG
   Begin:
       MOV AX, @data
       MOV DS, AX
       MOV DX, OFFSET HW
       MOV AH, 09H
       INT 21H
       MOV AX, 4C00H
       INT 21H
   END Begin

[modifica] awk

   BEGIN { print "Hello World!" }

[modifica] Bash

#!/bin/bash
echo "Hello World!"

[modifica] BASIC

BASIC tradizionale (non strutturato):

10 PRINT "Hello World!"
20 END

BASIC moderno (strutturato):

print "Hello World!"

[modifica] BasicAlgorytm

   %write "Hello World!"

[modifica] BCPL

   GET "LIBHDR"
    
   LET START () BE
   $(
       WRITES ("Hello World!*N")
   $)


[modifica] BeanShell

   print("Hello World!");

[modifica] Bourne shell

   echo 'Hello World!'

[modifica] Brainfuck

++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.

[modifica] C

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

[modifica] C++/CLI

int main()
{
  System::Console::WriteLine("Hello World!");
}

[modifica] C#

class HelloWorldApp
{
  public static void Main()
  {
    System.Console.WriteLine("Hello World!");
  }
}

[modifica] COBOL

   IDENTIFICATION DIVISION.
   PROGRAM-ID.     HELLO-WORLD.
    
   ENVIRONMENT DIVISION.
    
   DATA DIVISION.
    
   PROCEDURE DIVISION.
   DISPLAY 'Hello World!'. 

[modifica] ColdFusion

<cfset myString="Hello, World!">
<cfoutput>#myString#</cfoutput>

versione rapida

<cfoutput>Hello, World!</cfoutput>

versione CFScript

<cfscript>
    myString="Hello, World!";
    WriteOutput(myString);
</cfscript>

versione CFScript rapida

<cfscript>
    WriteOutput("Hello, World!");
</cfscript>


[modifica] Common LISP

(print "Hello, World!")

[modifica] D

import std.stdio;
void main(){
   writefln("Hello, World!");
}

[modifica] Delphi

program HelloWorld;
{$APPTYPE CONSOLE}
begin
  WriteLn('Hello World!');
end.

[modifica] EASY

   module helloworld
   procedure Main
     cgiclosebuffer
     cgiwriteln("content-type: text/html")
     cgiwriteln("")
     cgiwriteln("Hello World!")
   endproc

[modifica] Eiffel

class HELLO_WORLD
    &nbsp;
    creation
        make
    feature
        make is
        do
                io.put_string("Hello World!%N")
        end -- make
    end -- class HELLO_WORLD

[modifica] Emacs Lisp

(print "Hello World")

[modifica] Erlang

   -module(Hello).
   -export([Hello_World/0]).
    
   Hello_World() -> io:fwrite("Hello World!\n").

[modifica] Forth

 : Helloforth ( -- ) ." Hello World!" ;

[modifica] Fortran

PROGRAM HELLO
   WRITE(*,10)
10 FORMAT('Hello World!')
   STOP
   END

[modifica] Haskell

   main = putStrLn "Hello World!"


[modifica] IDL

print,'Hello World'

[modifica] Io

"Hello World" print

[modifica] Iptscrae

   ON ENTER {
       "Hello " "World!" & SAY
   }

[modifica] Java

public class Hello {
    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

[modifica] JSP

<%
    out.println("Hello, World!");
%>

Versione breve:

<%= "Hello, World!" %>

[modifica] riti

   print "Hello World!"

[modifica] Logo

   print word "Hello World!"

[modifica] MATLAB

fprintf('Hello, world !')

[modifica] MIRC scripting

alias helloworld {
.echo -a Hello World!
}

oppure, in forma breve, applicabile da una finestra qualunque:

/echo hello world

[modifica] 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

[modifica] MS-DOS Batch

@echo Hello World!

[modifica] Natural

   WRITE 'Hello World'
   *
   END

[modifica] Oberon

   MODULE HelloWorld;
   IMPORT Write;
   BEGIN
       Write.Line("Hello World!");
   END HelloWorld.

[modifica] Objective C (Con Cocoa)

#import <Foundation/Foundation.h>
 
int main (int argc, const char * argv[])
{
  NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
 
  NSLog(@"Hello, World!");
  [pool release];
 
  return 0;
}

[modifica] OCaml

let main () =
   print_endline "Hello World!";;

[modifica] OPL

   PROC Hello:
     PRINT "Hello World"
   ENDP

[modifica] Pascal

program Hello;
begin
  Writeln('Hello, World!');
end.

[modifica] Perl

#!/usr/bin/perl
print "Hello World!\n";

[modifica] PHP

<?php
    echo 'Hello World!';
?>

Oppure:

<?php
    print("Hello World!");
?>

Versione minimalista:

<?='Hello World!'?>

[modifica] Pike

   int main() {
       write("Hello World!\n");
       return 0;
   }

[modifica] PL/I

   Test: procedure options(main);
      declare My_String char(20) varying init('Hello World!');
      put skip list(My_String);
   end Test;

[modifica] PL/SQL

BEGIN
   DBMS_OUTPUT.PUT_LINE('Hello World!');
END;

[modifica] Prolog

   ?- write("Hello World!"), nl.

[modifica] PureBasic

   OpenConsole()
   Print("Hello World!")
   CloseConsole()

[modifica] Python

print "Hello World!"

Versione breve:

"Hello World!"

Versione Easter egg:

import __hello__

[modifica] REXX

   say "Hello World!"

[modifica] RPL

   << "Hello World!" 1 Disp>>

[modifica] Ruby

puts "Hello World!"

Versione minimalista:

p "Hello World!"

[modifica] Scheme

(display "Hello World!")
(newline)

[modifica] sed

Serve come minimo un Input:

   sed -ne '1s/.*/Hello World!/p'

Oppure, forma breve:

   sed 's/.*/Hello World!/'

[modifica] Seed7

$ include "seed7_05.s7i";

const proc: main is func
  begin
    writeln("Hello World!");
  end func;

[modifica] Smalltalk

Transcript show: 'Hello World!'

[modifica] SML

   print "Hello World!\n";

[modifica] SNOBOL4

       OUTPUT = "Hello World!"
   END

[modifica] STARLET

   RACINE: HELLO_WORLD.
    
   NOTIONS:
   HELLO_WORLD : ecrire("Hello World!").

[modifica] SQL

SELECT 'Hello World!' AS message;

Per Oracle-Database

SELECT 'Hello World!' FROM dual;

Per IBM-DB2

SELECT 'Hello World!' FROM sysibm.sysdummy1;

Per Microsoft SQL Server:

print 'Hello World!';

oppure:

VALUES('Hello World!');

[modifica] StarOffice Basic

   sub main
   print "Hello World!"
   end sub

[modifica] Tcl

puts "Hello World!"

[modifica] TI-BASIC

   :Disp "Hello World!"

[modifica] TOM

   int
     main Array arguments
   {
     [[[stdio out] print "Hello world!"] nl];
   }

[modifica] Turing

   put "Hello World!"

[modifica] Visual Basic .Net

Module Main
    Sub Main()
        Console.WriteLine("Hello World!")
    End Sub
End Module

[modifica] Grafici (tradizionale)

[modifica] AppleScript

display dialog "Hello World!"

[modifica] AutoIt v3

   MsgBox(0, "Hello World!", "Hello World!")

[modifica] C per GTK+

#include <gtk/gtk.h>
 
void hello(GtkWidget* widget, gpointer data)
{
    g_print("Hello, World!\n");
}
 
int main(int argc, char** argv)
{
    GtkWidget* window;
    GtkWidget* button;
 
    gtk_init(&argc, &argv);
 
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_container_set_border_width(GTK_CONTAINER(window), 10);
    g_signal_connect(G_OBJECT(window), "destroy",
                         G_CALLBACK(gtk_main_quit), NULL);
 
    button = gtk_button_new_with_label("Hello, World!");
    g_signal_connect(G_OBJECT(button), "clicked",
                         G_CALLBACK(hello), NULL);
 
    gtk_container_add(GTK_CONTAINER(window), button);
 
    gtk_widget_show(window);
    gtk_widget_show(button);
 
    gtk_main();
 
    return 0;
}

[modifica] C++ per FOX

#include "fx.h"
 
int main(int argc,char **argv)
{
  FXApp app("MyApp","Me");
  app.init(argc,argv);
  app.create();
  FXMessageBox::information(&app,MBOX_OK,"Message","Hello World!");
  return app.run();
}

[modifica] C++ per GTK+

#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::mem_fun(*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;
}

[modifica] C++ con Qt

#include <qapplication.h>
#include <qpushbutton.h>
 
int main( int argc, char **argv )
{
    QApplication a( argc, argv );
 
    QPushButton Hello( "Hello world!", 0 );
    Hello.resize( 100, 30 );
 
    a.setMainWidget( &Hello );
    Hello.show();
    return a.exec();
}

[modifica] C#

namespace Hello_World
{
 using System;
 using System.Windows.Forms;
 
 public class HelloWorld : Form
 {
    public static void Main()
    {
       Application.Run(new HelloWorld());
    }
 
    public HelloWorld()
    {
       this.Text = "Hello World !" ;
    }
  }
}

[modifica] Clarion

   program
    
   window WINDOW('Hello World'),AT(,,300,200),STATUS,SYSTEM,GRAY,DOUBLE,AUTO
          END
    
   code        
    
   open(window)
   show(10,10,'Hello World')
   accept
   end
   close(window)

[modifica] Delphi

program HelloWorld;
 
uses Dialogs;
 
begin
  ShowMessage('Hello World!');
end.

[modifica] EASY

Nella Variante VDP:

   module helloworld
   procedure Main
     Message("Hello World!")
   endproc

o pure


edit1.text:='Hello World';

[modifica] Gambas

   PUBLIC SUB Form_Open()
     Message.Info("Hello World!")
   END

[modifica] Java

  • AWT:
import java.awt.Frame;
    import java.awt.Label;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
 
    public class HelloWorldFenster extends Frame {
        public HelloWorldFenster() {
            super("Hello World!");
            Label HelloWorldLabel = new Label("Hello World!");
            add(HelloWorldLabel);
            addWindowListener(new WindowAdapter() {
                 public void windowClosing(WindowEvent e) {
                     System.exit(0);
                 }
            });
            setResizable(false);
            setLocation(350, 320);
            setSize(160, 60);
            setVisible(true);
        }
        public static void main(String[] args) {
            new HelloWorldFenster();
        }
    }
import javax.swing.JFrame;
    import javax.swing.JLabel;
 
    public class HelloWorld extends JFrame {
        public HelloWorld() {
            super("Hello World!");
            JLabel HelloWorldLabel = new JLabel("Hello World!");
            getContentPane().add(HelloWorldLabel);
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            setResizable(false);
            setLocation(350, 320);
            setSize(160, 60);
            setVisible(true);
        }
 
        public static void main(String[] args) {
            new HelloWorld();
        }
    }

[modifica] LISP

(alert "Hello World!")

[modifica] PureBasic

   MessageRequester("","Hello World")

[modifica] Tcl/Tk

   label .label1 -text "Hello World"
   pack .label1

Versione corta:

   pack [label .label1 -text "Hello World"]

[modifica] Visual Basic .Net

MessageBox.Show("Hello World!")

[modifica] Visual Basic

MsgBox "Hello World!"

[modifica] Waba / SuperWaba

import waba.ui.*;
import waba.fx.*;
 
public class HelloWorld extends MainWindow
{
 
  public void onPaint(Graphics g)
  {
    g.setColor(0, 0, 0);
    g.drawText("Hello World!", 0, 0);
  }
}

[modifica] Windows API (in Borland Pascal)

program Hello;
    uses WinTypes, WinProcs;
    const
      szClassName = 'PASCLASS32';
    function WndProc(Window: HWnd; Message, WParam: Word;
      LParam: Longint): Longint; export;
    var
      LPPaint : TPaintStruct;
      TheDC   : HDC;
    begin
      WndProc := 0;
      case Message of
        wm_Destroy:
        begin
          PostQuitMessage(0);
          Exit;
        end;
        wm_Paint:
        begin
          TheDC := BeginPaint(Window, LPPaint);
          TextOut(TheDC, 5, 5, 'hello, world', 12);
        end;
      end;
      WndProc := DefWindowProc(Window, Message, WParam, LParam);
    end;
    procedure WinMain;
    var
      Window: HWnd;
      Message: TMsg;
    const
      WindowClass: TWndClass = (
        style: 0;
        lpfnWndProc: @WndProc;
        cbClsExtra: 0;
        cbWndExtra: 0;
        hInstance: 0;
        hIcon: 0;
        hCursor: 0;
        hbrBackground: 0;
        lpszMenuName: szClassName;
        lpszClassName: szClassName);
    begin
      if HPrevInst = 0 then
      begin
        WindowClass.hInstance := HInstance;
        WindowClass.hIcon := LoadIcon(0, idi_Application);
        WindowClass.hCursor := LoadCursor(0, idc_Arrow);
        WindowClass.hbrBackground := GetStockObject(white_Brush);
        if not RegisterClass(WindowClass) then
          Halt(255);
      end;
      Window := CreateWindow(
        szClassName,
        'Win32 Pascal Program',
        ws_OverlappedWindow,
        cw_UseDefault,
        cw_UseDefault,
        cw_UseDefault,
        cw_UseDefault,
        0,
        0,
        HInstance,
        nil);
      ShowWindow(Window, CmdShow);
      UpdateWindow(Window);
      while GetMessage(Message, 0, 0, 0) do
      begin
        TranslateMessage(Message);
        DispatchMessage(Message);
      end;
      Halt(Message.wParam);
    end;
    begin
      WinMain;
    end.

[modifica] Windows API (in Borland Turbo Assembler)

   .386
   LOCALS
   JUMPS
   .model FLAT, STDCALL
   INCLUDE WIN32.INC
   L EQU <LARGE>
   EXTRN            BeginPaint:PROC
   EXTRN            CreateWindowExA:PROC
   EXTRN            DefWindowProcA:PROC
   EXTRN            DispatchMessageA:PROC
   EXTRN            EndPaint:PROC
   EXTRN            ExitProcess:PROC
   EXTRN            FindWindowA:PROC
   EXTRN            GetMessageA:PROC
   EXTRN            GetModuleHandleA:PROC
   EXTRN            GetStockObject:PROC
   EXTRN            InvalidateRect:PROC
   EXTRN            LoadCursorA:PROC
   EXTRN            LoadIconA:PROC
   EXTRN            MessageBeep:PROC
   EXTRN            MessageBoxA:PROC
   EXTRN            PostQuitMessage:PROC
   EXTRN            RegisterClassA:PROC
   EXTRN            ShowWindow:PROC
   EXTRN            SetWindowPos:PROC
   EXTRN            TextOutA:PROC
   EXTRN            TranslateMessage:PROC
   EXTRN            UpdateWindow:PROC
   CreateWindowEx   EQU <CreateWindowExA>
   DefWindowProc    EQU <DefWindowProcA>
   DispatchMessage  EQU <DispatchMessageA>
   FindWindow       EQU <FindWindowA>
   GetMessage       EQU <GetMessageA>
   GetModuleHandle  EQU <GetModuleHandleA>
   LoadCursor       EQU <LoadCursorA>
   LoadIcon         EQU <LoadIconA>
   MessageBox       EQU <MessageBoxA>
   RegisterClass    EQU <RegisterClassA>
   TextOut          EQU <TextOutA>
   .data
   Copyright        DB "Turbo Assembler 32 - Hello world", 0
   NewHWND          DD 0
   lpPaint          PAINTSTRUCT <?>
   Msg              MSGSTRUCT   <?>
   wc               WNDCLASS    <?>
   hInst            DD 0
   szTitleName      DB "Win32 Assembly Program"
   Zero             DB 0
   szAlternate      DB "(Secondary)", 0
   szClassName      DB "ASMCLASS32", 0
   szHello          DB "hello, world", 0
   HelloLength      EQU ($ - OFFSET szHello) - 1
   .code
   Begin:
       PUSH    L 0
       CALL    GetModuleHandle
       MOV     [hInst], EAX
       PUSH    L 0
       PUSH    OFFSET szClassName
       CALL    FindWindow
       OR      EAX, EAX
       JZ      RegClass
       MOV     [Zero], ' '
   RegClass:
       MOV     [wc.clsStyle], CS_HREDRAW + CS_VREDRAW + CS_GLOBALCLASS
       MOV     [wc.clsLpfnWndProc], OFFSET WndProc
       MOV     [wc.clsCbClsExtra], 0
       MOV     [wc.clsCbWndExtra], 0
       MOV     EAX, [hInst]
       MOV     [wc.clsHInstance], EAX
       PUSH    L IDI_APPLICATION
       PUSH    L 0
       CALL    LoadIcon
       MOV     [wc.clsHIcon], EAX
       PUSH    L IDC_ARROW
       PUSH    L 0
       CALL    LoadCursor
       MOV     [wc.clsHCursor], EAX
       MOV     [wc.clsHbrBackground], COLOR_WINDOW + 1
       MOV     DWORD PTR [wc.clsLpszMenuName], 0
       MOV     DWORD PTR [wc.clsLpszClassName], OFFSET szClassName
       PUSH    OFFSET wc
       CALL    RegisterClass
       PUSH    L 0                      ; lpParam
       PUSH    [hInst]                  ; hInstance
       PUSH    L 0                      ; menu
       PUSH    L 0                      ; parent hwnd
       PUSH    L CW_USEDEFAULT          ; height
       PUSH    L CW_USEDEFAULT          ; width
       PUSH    L CW_USEDEFAULT          ; y
       PUSH    L CW_USEDEFAULT          ; x
       PUSH    L WS_OVERLAPPEDWINDOW    ; Style
       PUSH    OFFSET szTitleName       ; Title string
       PUSH    OFFSET szClassName       ; Class name
       PUSH    L 0                      ; extra style
       CALL    CreateWindowEx
       MOV     [NewHWND], EAX
       PUSH    L SW_SHOWNORMAL
       PUSH    [NewHWND]
       CALL    ShowWindow
       PUSH    [NewHWND]
       CALL    UpdateWindow
   MsgLoop:
       PUSH    L 0
       PUSH    L 0
       PUSH    L 0
       PUSH    OFFSET Msg
       CALL    GetMessage
       CMP     AX, 0
       JE      EndLoop
       PUSH    OFFSET Msg
       CALL    TranslateMessage
       PUSH    OFFSET Msg
       CALL    DispatchMessage
       JMP     MsgLoop
   EndLoop:
       PUSH    [Msg.msWPARAM]
       CALL    ExitProcess
   WndProc PROC USES EBX EDI ESI, hwnd:DWORD, wmsg:DWORD, wparam:DWORD, lparam:DWORD
       LOCAL   TheDC:DWORD
       CMP     [wmsg], WM_DESTROY
       JE      wmDestroy
       CMP     [wmsg], WM_RBUTTONDOWN
       JE      wmRButtonDown
       CMP     [wmsg], WM_SIZE
       JE      wmSize
       CMP     [wmsg], WM_CREATE
       JE      wmCreate
       CMP     [wmsg], WM_LBUTTONDOWN
       JE      wmLButtonDown
       CMP     [wmsg], WM_PAINT
       JE      wmPaint
       CMP     [wmsg], WM_GETMINMAXINFO
       JE      wmGetMinMaxInfo
       JMP     DefWndProc
   wmPaint:
       PUSH    OFFSET lpPaint
       PUSH    [hwnd]
       CALL    BeginPaint
       MOV     [TheDC], EAX
       PUSH    L HelloLength     ; lunghezza stringa
       PUSH    OFFSET szHello    ; stringa
       PUSH    L 5               ; y
       PUSH    L 5               ; x
       PUSH    [TheDC]           ; DC
       CALL    TextOut
       PUSH    OFFSET lpPaint
       PUSH    [hwnd]
       CALL    EndPaint
       MOV     EAX, 0
       JMP     Finish
   wmCreate:
       MOV     EAX, 0
       JMP     Finish
   DefWndProc:
       PUSH    [lparam]
       PUSH    [wparam]
       PUSH    [wmsg]
       PUSH    [hwnd]
       CALL    DefWindowProc
       JMP     Finish
   wmDestroy:
       PUSH    L 0
       CALL    PostQuitMessage
       MOV     EAX, 0
       JMP     Finish
   wmLButtonDown:
       PUSH    L 0
       PUSH    L 0
       PUSH    [hwnd]
       CALL    InvalidateRect    ; ridisegna finestra
       MOV     EAX, 0
       JMP     Finish
   wmRButtonDown:
       PUSH    L 0
       CALL    MessageBeep
       JMP     Finish
   wmSize:
       MOV     EAX, 0
       JMP     Finish
   wmGetMinMaxInfo:
       MOV     EBX, [lparam]  ; ptr a minmaxinfo struct
       MOV     [(MINMAXINFO PTR ebx).mintrackposition_x], 350
       MOV     [(MINMAXINFO PTR ebx).mintrackposition_y], 60
       MOV     EAX, 0
       JMP     Finish
   Finish:
       RET
   WndProc ENDP
   PUBLIC WndProc
   ENDS
   END Begin
   ; creare questo file HELLO.DEF:
   NAME         HELLO
   DESCRIPTION 'Assembly Win32 Program'
   CODE         PRELOAD MOVEABLE DISCARDABLE
   DATA         PRELOAD MOVEABLE MULTIPLE
   EXETYPE      WINDOWS
   HEAPSIZE     8192
   STACKSIZE    8192
   EXPORTS      WndProc
   ; fine HELLO.DEF

[modifica] Windows API (in C)

#include <windows.h>
 
    LRESULT CALLBACK WindowProcedure(HWND, UINT, WPARAM, LPARAM);
 
    char szClassName[] = "MainWnd";
    HINSTANCE hInstance;
 
    int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
    {
      HWND hwnd;
      MSG msg;
      WNDCLASSEX wincl;
 
      hInstance = hInst;
 
      wincl.cbSize = sizeof(WNDCLASSEX);
      wincl.cbClsExtra = 0;
      wincl.cbWndExtra = 0;
      wincl.style = 0;
      wincl.hInstance = hInstance;
      wincl.lpszClassName = szClassName;
      wincl.lpszMenuName = NULL; //No menu
      wincl.lpfnWndProc = WindowProcedure;
      wincl.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); //Color of the window
      wincl.hIcon = LoadIcon(NULL, IDI_APPLICATION); //EXE icon
      wincl.hIconSm = LoadIcon(NULL, IDI_APPLICATION); //Small program icon
      wincl.hCursor = LoadCursor(NULL, IDC_ARROW); //Cursor
 
      if (!RegisterClassEx(&wincl))
            return 0;
 
      hwnd = CreateWindowEx(0, //No extended window styles
            szClassName, //Class name
            "Window", //Window caption
            WS_OVERLAPPEDWINDOW & ~WS_MAXIMIZEBOX,
            CW_USEDEFAULT, CW_USEDEFAULT, //Let Windows decide the left and top positions of the window
            120, 50, //Width and height of the window,
            NULL, NULL, hInstance, NULL);
 
      //Make the window visible on the screen
      ShowWindow(hwnd, nCmdShow);
 
      //Run the message loop
      BOOL bRet;
      while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0)
      { 
            if (bRet == -1)
            {
                   // handle the error and possibly exit
            }
            else
            {
                  TranslateMessage(&msg); 
                  DispatchMessage(&msg); 
            }
      } 
      return msg.wParam;
    }
 
    LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
      PAINTSTRUCT ps;
      HDC hdc;
      switch (message)
      {
      case WM_PAINT:
            hdc = BeginPaint(hwnd, &ps);
            TextOut(hdc, 15, 3, "Hello World!", 13);
            EndPaint(hwnd, &ps);
            break;
      case WM_DESTROY:
            PostQuitMessage(0);
            break;
      default:
            return DefWindowProc(hwnd, message, wParam, lParam);
      }
      return 0;
    }

[modifica] X Window

   xmessage hello, world!

[modifica] Zenity

   zenity --info --text='Hello world!'

[modifica] Grafici – basati su un Browser

[modifica] Curl

{curl  (Version)applet}
Hello world

[modifica] Java applet

Java applet funzionona in collegamento con HTML.

import java.applet.*;
import java.awt.*;
 
public class HelloWorld extends Applet {
  public void paint(Graphics g) {
    g.drawString("Hello World!", 100, 50);
  }
}

Codice HTML per vedere l'Applet con un Browser.

<object classid="java:HelloWorld.class"
        codetype="application/java-vm"
        width="600" height="100">
</object>

[modifica] JavaScript, alias ECMAScript

<script type="text/javascript">
   alert("Hello World!");
</script>

Oppure:

<script type="text/javascript">
   document.write("Hello World!");
</script>

[modifica] VBScript

<script language="VBScript">
    MsgBox "Hello World!"
</script>

[modifica] XUL

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

[modifica] XAML

<?Mapping ClrNamespace="System" Assembly="mscorlib" XmlNamespace=" http://www.gotdotnet.com/team/dbox/mscorlib/System" ?>
<Object xmlns=" http://www.gotdotnet.com/team/dbox/mscorlib/System" xmlns:def="Definition" def:Class="MyApp.Hello">
    <def:Code>
    <![CDATA[
     Shared Sub Main()
     '{
         System.Console.WriteLine("Hello World!")' ;
     '}
     End Sub
    ]]>
    </def:Code>
</Object>

[modifica] Linguaggi di markup o di formattazione

I Linguaggi di markup o di formattazione non sono dei veri e propri linguaggi di programmazione, ma sono stati creati per descrivere come le informazioni vanno impaginate su un generico supporto.

[modifica] HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
 <head>
   <title>Hello World!</title>
 </head>
 <body>
   <p>Hello World!</p>
 </body>
</html>

[modifica] LATEX

\documentclass{article}
\begin{document}
Hello World!
\end{document}

[modifica] MetaPost

   defaultfont := "Courier";
   
   beginfig(0);
   label("Hello, world!", (10,10));
   endfig;
   
   end.

[modifica] PostScript

   /Courier findfont
   24 scalefont
   setfont
   100 100 moveto
   (Hello World!) show
   showpage

[modifica] RTF

   {\rtf1\ansi\deff0
   {\fonttbl {\f0 Courier New;}}
   \f0\fs20 Hello World!
   }

[modifica] TEX

   \font\HW=cmr10 scaled 3000
   \leftline{\HW Hello World}
   \bye

[modifica] Collegamenti esterni


Principali linguaggi di programmazione (tutti)

Ada | ALGOL | APL | Awk | BASIC | C | C++ | C# | COBOL | Delphi | Eiffel | Fortran | Haskell | IDL | Java | JavaScript | J# | Lisp | LOGO | ML | Objective C | O'Caml | Pascal | Perl | PHP | PL/I | PLaSM | Prolog | Python | Ruby | SAS | Scheme | sh | Simula | Smalltalk | SQL | Transact-SQL | Visual Basic


aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - en - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu -