Hello World Program Collection _ Other synthesis

Source: Internet
Author: User
Tags gtk stub

Hello world, as the beginning of all programming languages, occupies an immutable position, all the Chinese/English/French/German/American ... Version of the programming textbook, Hello World is always recorded as the first Test in the book, all the first step of programming is this! Classic Among the classics!

Hello world!

The "Hello, World" program is a computer program that prints the string of Hello, the globe, on a computer screen, and "Hello" is the Chinese meaning of "hello". This routine was widely used in the C programming language, which was co-authored by Brian Kernighan and Dennis M. Ritchie. Because it is concise, practical, and contains a program should have everything, so the author of the later programming books to provide an example, has been continued to this.

Hello World Program Complete

ActionScript

Trace ("Hello, world!");

Ada

with Text_io;

Procedure HELLO is
begin
 Text_io. Put_Line ("Hello, world!");
End HELLO;

Assembly

x86 cpu,gnu/linux,nasm

Section. Data
 msg  db  ' Hello, world! ', 0xA
 len  equ  $-msg section

 . Text
 Global _start
 _start:
  mov  edx,len
  mov  ecx,msg
  mov  ebx,1
  mov  eax,4
  int  0x80

  mov  ebx,0
  mov  eax,1
  int  0x80

x86 at&t, Gas

. Data
 msg:. String "Hello, world!\n"
 len =.-Msg
. Text
. Global _start

_start:
 movl $len ,%edx
 movl $msg,%ecx
 movl $,%ebx movl $,
 %eax
 int $0x80

 MOVL $,%ebx movl
 $,%eax
 int $0x80

x86 CPU, Windows, MASM32

 .386
 . Model flat,stdcall
 option Casemap:none
; ====================================================== = = =
include  windows.inc
include  user32.inc
includelib user32.lib
include  Kernel32.inc
includelib kernel32.lib
; ==========================================================
 . Data
szcaption db "A messagebox!", 0
sztext db "Hello, world!", 0
; ============================= =============================
 . Code
Start:
invoke MessageBox, NULL, addr sztext, addr szcaption, MB_OK
invoke ExitProcess, NULL
; ========================================================== End
Start

8086 operating System

[BITS]
org 0x7c00
 mov ax,cs mov
 ds,ax
 mov es,ax call
 dispstr
 $; End Hear
dispstr:
 mov ax, bootmessage
 mov bp, ax
 mov cx, 16; How long is the String
 mov-ax, 0x1301
 mov bx, 0x000c
 mov dl, 0
 int 0x10
 ret
bootmessage:db "Hello, world!."
Times 510-($-$$) DB 0x0
DW 0xaa55; Bootable Mark.

Asp

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

or simply write:

<%= "Hello, world!"%>

AutoIt

MsgBox (1, ', ' Hello, world! ')

Awk

BEGIN {print "Hello, world!"}
Bash (or SH)

echo ' Hello, world! '

Or:

printf ' Hello, world!\n '

BASIC

Traditional version BASIC (for example, Gwbasic):

PRINT "Hello, world!"
End

Or at the prompt, enter:

? "Hello, world!."

Modern basic (for example, Quick Basic):

PRINT "Hello, world!"

The following statement is also valid in Quick BASIC:

? "Hello, world!."

Bcpl

Get "LIBHDR" let

START ()
$ (
 writes ("Hello, World!*n")
$)

Brainfuck


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

Blitzbasic

Print "Hello, world!"
Waitkey

BOO

Print "Hello, world!"

C

#include <stdio.h>

int main (void)
{
 printf ("Hello, world!\n");
 return 0;
}

Or:

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

C++

#include <iostream>

int main ()
{
 std::cout << "Hello, world!" << Std::endl;
 return 0;
}

Or:

#include <iostream>
using namespace std;

int main ()
{
 cout << "Hello, world!" << Endl;
 return 0;
}

C++/cli

int main ()
{
 system::control::writeline ("Hello, world!");
}

C # (SHARP)

Class Helloworldapp
{
 static void Main (string[] args)
 {
  System.Console.WriteLine ("Hello, world!");
 }
}

or (for Microsoft Windows only)

Class Helloworldapp
{
  [DllImport ("user32.dll")]
  static extern MessageBox (string title, String message );
  public static void Main ()
  {
   MessageBox (null, "Hello, world!");
  }

or (using additional Windows Forms)

Using System.Windows.Forms;
Class Helloworldapp
{public
  static void Main ()
  {
   MessageBox.Show ("Hello, world!");
  }

Cobol

Identification Division.
Program-id. Hello-world.

Environment Division.

DATA Division.

PROCEDURE Division.
DISPLAY "Hello, world!".
STOP RUN.

Common Lisp

; Direct output
"Hello world!"

; or

(Format T "Hello world!~%")

DOS Batch Processing

@echo Hello, world!

For MS-DOS 3.0 or later:

echo off
cls
Echo Hello, world!

Linux Shell

Echo Hello, world!

Eiffel

Class Hello_world

creation make feature be 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

WRITE (*,*) ' Hello, world! '
STOP End

Html

<!--direct output ...-->

Hello World

<!--or-->

 
 

hq9+

H

intercal do 

, 1 <-#13 does,
1 sub #1 <-#238 do,
1 sub #2 <-#112 do
, 1 sub #3 <-#  112 do,
1 sub #4 <-#0 does,
1 sub #5 <-#64 do,
1 sub #6 <-#238 does
, 1 SUB #7 <-#26
do, 1 Sub #8 <-#248 do
, 1 sub #9 <-#168 do
, 1 sub #10 <-#24 does,
1 sub #11 <-#16 do,
1 sub # <-#158 do
, 1 SUB #13 <-#52 "
READ out, 1"
give up

Java

public class Hello
{public
 static void Main (string[] args)
 {
  System.out.println ("Hello, world!");
 }
}

or in tinystruct2.0:

Package tinystruct.examples;
Import org.tinystruct.AbstractApplication;
Import org.tinystruct.Application;
Import org.tinystruct.ApplicationException;

Import Org.tinystruct.system.ApplicationManager; public class Hello extends abstractapplication {@Override public void init () {//TODO auto-generated a stub this
. Setaction ("Say", "say");

@Override public String version () {//TODO auto-generated method stub return null;}
 public string Say (string words) {System.out.println (words);
return words; }/** * @param args * @throws applicationexception/public static void main (string[] args) throws Applicationexcept
 Ion {//TODO auto-generated a stub//praise to the lord!

 Applicationmanager.install (new Hello ());    To print ' Hello World ' Applicationmanager.call ("Say/hello World", null);
 Hello World//or ... 
 Application App=applicationmanager.get (Hello.class.getName ()); App.invoke ("Say", New object[]{" 

Jsp

<%
 out.print ("Hello, world!");
%>
or simply write:

<%= "Hello, world!" %>

Lisp

; Direct output
"Hello, World"

; or
(format T "Hello, world~%")

Lua

Print "Hello, world!"

Malbolge

 (' &%:9]!~}|Z2VXWV-,POQPONL$HJIG%EB@@>}=<M:9WV6WSU2T|NM-,JCL i&%$# '
 CB]V? TX<UVTT ' rpo3nlf.jh++fdbcba@?]! ~|4XZYTT43QSQQ (lnmkj "fhg${z@>

MetaPost

Beginfig (1);
Draw (0,0)-(0,10);
Draw (0,5)-(5,5);
Draw (5,0)-(5,10);
Draw (12,0)-(7,0)-(7,10)-(12,10);
Draw (12,5)-(7,5);
Draw (14,10)-(14,0)-(19,0);
Draw (21,10)-(21,0)-(26,0);
Draw (28,5) ... (30.5,0) ... (33,5) ... (30.5,10) ... cycle;
Draw (38,10)-(39.25,0)-(40.5,10)-(41.75,0)-(43,10);
Draw (45,5) ... (47.5,0) ... (50,5) ... (47.5,10) ... cycle;
Draw (52,0)-(52,10);
Draw (52,10). (57,4). (52,6.5);
Draw (52,5)-(57,0);
Draw (61,10)-(61,0)-(66,0);
Draw (68,10)-(68,0). (73,5). cycle;
Endfig;
End

Mixal

TERM EQU The MIX console device number
  ORIG 1000  start address start off
MSG (TERM) output data at Addres s msg
  hlt    halt execution
msg ALF "Mixal" ALF
  "HELL"
  ALF "O WOR"
  ALF "LD" End
  start
   end of the program

Nuva

. Direct output. >
Hello, world!

. Or.. >

.
 No Line wrap
 ? "Hello, world!."

 or

 //with line change
 ?? ' Hello, world! '
. >

OCaml

Let main () =
 print_endline "Hello world!";;

Pascal

Program Hello; {This row can be omitted}
Begin
 Writeln (' Hello, world! ');
End.

Perl

#!/usr/bin/env perl
print "Hello, world!\n";

Perl 5.10 (including) later versions:

#!/usr/bin/env Perl use
5.010;
Say "Hello, world!";

Php

<?php
 Echo ' Hello, world! '; /usually use this, a character smaller than print
 ' Hello, world! ';
? >
or

<?= "Hello world!"? >

Pike

#!/usr/local/bin/pike
int main ()
{
 write ("Hello, world!\n");
 return 0;
}

pl/i

Test:procedure options (main);
 Declare my_string char varying initialize (' Hello, world! ');
 Put skip list (my_string);
End Test;

Prolog

Goal
 Write ("hello,world!").

Python

For Python 2:

#!/usr/bin/env python
print "Hello, world!"
For Python 3:

#!/usr/bin/env python
print ("Hello, world!")

Rexx

Say "Hello, world!"

Ruby

#!/usr/bin/ruby
puts "Hello, world!"

Sbyke Laborana

INIT min:1001
Om: "Hello, world!"

Scheme

(Display "Hello, world!")
(newline)

Sed

(requires at least one line

of input) Sed-ne ' 1s/.*/hello, world!/p '

Seed7

$ include "seed7_05.s7i";

 Const Proc:main is func
 begin
  Writeln ("Hello, world!");
 End Func;

Smalltalk

Transcript show: ' Hello, world! '

Small Basic

TextWindow.WriteLine ("Hello, world!")

Snobol

OUTPUT = "Hello, world!"
End

Sql

The first

CREATE TABLE message (TEXT CHAR);
INSERT into message (TEXT) VALUES (' Hello, world! ');
SELECT TEXT from message;
DROP TABLE message;
The second

SELECT ' Hello, world ';
The third kind of

print ' hello,world! '

Tcl

#!/usr/local/bin/tcl
puts "Hello, world!"

Tscript

? "Hello, world!."

Turing

Put "Hello, world!"

Unix-style Shell

The/bin/sh in the program can be changed to the shell you use

#!/bin/sh
Echo ' Hello, world! '

Bc

 #!/usr/bin/bc-q
print "Hello World"
quit

dc

#!/usr/bin/env DC [Hello world]p

Gui

Delphi

program HelloWorld;
Uses
 Dialogs;
Begin
 ShowMessage (' Hello, world! ');
End.

Nuva

.
 System.Ui.ShowMessage (' Nuva ', ' Hello, world! ', [' OK '])
.>

Visual Basic

MsgBox "Hello, world!"
or

Print "Hello, world!"

Visual FoxPro

? "Hello, world!."

X11

Using a program

Xmessage ' Hello, world! '

Using QT

#include <QApplication>
#include <QLabel>

int main (int argc, char *argv[])
{
 Qapplication app (argc, argv);
 Qlabel label ("Hello, world!");
 Label.show ();
 return app.exec ();
}

C and GTK +

#include <gtk/gtk.h>

int main (int argc, char * args[])
{
 Gtkwidget * win, * label;
 Gtk_init (& argc, & args);

 Label = Gtk_label_new ("Hello, world!");
 Win = Gtk_window_new (gtk_window_toplevel);
 Gtk_container_add (Gtk_container (Win), label);
 Gtk_widget_show_all ();

 Gtk_main ();

 return 0;
}

With C + + and GTKMM 2

#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 (a);
 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);
}

Java

Import java.awt.*;
Import java.awt.event.*;

public class Helloframe extends Frame 
{
 helloframe (String title) 
 {
  super (title);
 }
 public void Paint (Graphics g)
 {
  super.paint (g);
  Java.awt.Insets ins = This.getinsets ();
  g.DrawString ("Hello, world!", Ins.left +, Ins.top +);
 }
 public static void Main (String args [])
 {
  Helloframe fr = new Helloframe ("Hello");

  Fr.addwindowlistener (
   new Windowadapter () 
   {public
    void windowclosing (WindowEvent e)
    {
     System.exit (0);
    }
   }
  );
  Fr.setresizable (true);
  Fr.setsize (a);
  Fr.setvisible (True);
 }


Java applets

Java applets are used in HTML files.

HTML code:


Import java.applet.*;
Import java.awt.*;

public class HelloWorld extends applets 
{public
 void paint (Graphics g) 
 {
  g.drawstring ("Hello, World! ", M,);
 }


Javascript

JavaScript is a scripting language. The most widely used in HTML files can also be used in other hosting environments, such as the Microsoft Windows Scripting Host (WSH) and some Web service environments.

Used in HTML:

Alert ("Hello, world!");
or
document.write ("Hello, world!");

Used in WSH:

WScript.Echo ("Hello, world!");

PostScript

PostScript is a language specifically used to create images, often used in printers.

/font/courier findfont scalefont
font setfont
moveto
(Hello world!) show
showpage

Xaml

<page
xmlns= "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x= "http:// Schemas.microsoft.com/winfx/2006/xaml "
x:class=" Xamlsample.page1 "
>
<button click=" HelloWorld "Name=" Button1 ">click here</button>
</Page>

using System;
Using System.Windows;
Using System.Windows.Controls;

Namespace Xamlsample
{public
 partial class page1:page
 {
  void HelloWorld (object sender, RoutedEventArgs e)
  {
   MessageBox.Show ("Hello, world!");
  }
 }


Easy language

. Version 2
. assembly Window Assembly 1
. subroutine __ Start Window _ Create complete
Information box

("Hello, world!", 0,)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.