Hallo Welt Zurück (aus Wikipedia, der freien Enzyklopädie )
Hallo, Welt! oder auch "Hello World!" (engl.), ist ein bekanntes Beispielprogramm, das am Anfang fast jeden Programmierkurses vorkommt.
Das fertige Computerprogramm gibt lediglich den Text "Hello world!" (oder etwas ähnliches) auf dem Bildschirm aus. Dieses Programm soll dem angehenden Programmierer zeigen, was alles für ein vollständiges Programm (in der betreffenen Programmiersprache) benötigt wird, und einen ersten Einblick in die Syntax geben.
with Ada.Text_Io; use Ada.Text_Io;
procedure Hallo is
begin
Put_Line ("Hallo, Welt!");
end Hallo; MODEL SMALL
IDEAL
STACK 100H
DATASEG
HW DB 'Hallo, Welt!$'
CODESEG
MOV AX, @data
MOV DS, AX
MOV DX, OFFSET HW
MOV AH, 09H
INT 21H
MOV AX, 4C00H
INT 21H
END BEGIN { print "Hallo, Welt!" } Traditionelles, unstrukturiertes BASIC
10 PRINT "Hallo, Welt!"
20 END
Eher modernes, strukturiertes BASIC
print "Hallo, Welt!" GET "LIBHDR"
LET START () BE
$(
WRITES ("Hallo, Welt!*N")
$) #include <stdio.h>
int main(void) {
printf("Hallo, Welt!\n");
return 0;
} #include <iostream>
using namespace std;
int main() {
cout << "Hallo, Welt!" << endl;
return 0;
} class HalloWeltApp {
public static void Main() {
System.Console.WriteLine("Hallo, Welt!");
}
} IDENTIFICATION DIVISION.
PROGRAM-ID. HALLO-WELT.
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
DISPLAY "Hallo, Welt!".
STOP RUN.(format t "Hallo Welt!~%")
class HALLO_WELT
creation
make
feature
make is
local
io:BASIC_IO
do
!!io
io.put_string("%N Hallo, Welt!")
end -- make
end -- class HALLO_WELT -module(Hallo).
-export([Hallo_Welt/0]).
Hallo_Welt() -> io:fwrite("Hallo, Welt!\n").." Hallo, Welt!" CR
PROGRAM HALLO
WRITE(*,10)
10 FORMAT('Hallo, Welt!')
STOP
END ON ENTER {
"Hallo, " "Welt!" & SAY
} public class Hallo {
public static void main(String[] args) {
System.out.println("Hallo, Welt!");
}
}print "Hallo, Welt!"
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 @echo off
echo Hallo, Welt! let main () =
print_endline "Hallo Welt!";; PROC Hallo:
PRINT "Hallo, Welt"
ENDP program Hallo;
begin
writeln('Hallo, Welt!');
end.print "Hallo, Welt!\n";
<?php
print("Hallo, Welt!");
?> #!/usr/local/bin/pike
int main() {
write("Hallo, Welt!\n");
return 0;
} Test: procedure options(main);
declare My_String char(20) varying initialize('Hallo, Welt!');
put skip list(My_String);
end Test; ?- write("Hallo, Welt!"), nl.print "Hallo, Welt!"
say "Hallo, Welt!"
print "Hallo, Welt!\n"
(display "Hallo, Welt!")
(newline)Benötigt mindestens eine Zeile als Eingabe:
sed -ne '1s/.*/Hallo, Welt!/p'
Transcript show: 'Hallo, Welt!'
print "Hallo, Welt!\n";
OUTPUT = "Hallo, Welt!"
ENDselect "Hallo, Welt!" as message;
sub main
print "Hallo, Welt"
end subputs "Hallo, Welt!"
:Disp "Hallo, Welt!"
put "Hallo, Welt!"
echo 'Hallo, Welt!'
MsgBox "Hallo, Welt!"
#include <iostream>
#include <gtkmm/main.h>
#include <gtkmm/button.h>
#include <gtkmm/window.h>
using namespace std;
class HalloWelt : public Gtk::Window {
public:
HalloWelt();
virtual ~HalloWelt();
protected:
Gtk::Button m_button;
virtual void on_button_clicked();
};
HalloWelt::HalloWelt()
: m_button("Hallo, Welt!") {
set_border_width(10);
m_button.signal_clicked().connect(SigC::slot(*this,
&HalloWelt::on_button_clicked));
add(m_button);
m_button.show();
}
HalloWelt::~HalloWelt() {}
void HalloWelt::on_button_clicked() {
cout << "Hallo, Welt!" << endl;
}
int main (int argc, char *argv[]) {
Gtk::Main kit(argc, argv);
HalloWelt HalloWelt;
Gtk::Main::run(HalloWelt);
return 0;
} #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 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
while (GetMessage(&msg, NULL, 0, 0))
{
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, "Hallo, Welt!", 13);
EndPaint(hwnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, message, wParam, lParam);
}
return 0;
} import java.awt.*;
import java.awt.event.*;
public class HalloFrame extends Frame {
HalloFrame(String title) {
super(title);
}
public void paint(Graphics g) {
super.paint(g);
java.awt.Insets ins = this.getInsets();
g.drawString("Hallo, Welt!", ins.left + 25, ins.top + 25);
}
public static void main(String args [])
{
HalloFrame fr = new HalloFrame("Hallo");
fr.addWindowListener(
new WindowAdapter() {
public void windowClosing(WindowEvent e)
{
System.exit( 0 );
}
}
);
fr.setResizable(true);
fr.setSize(500, 100);
fr.setVisible(true);
}
}Java applets funktionieren in Verbindung mit HTML.
<HTML>
<HEAD>
<TITLE>Hallo Welt</TITLE>
</HEAD>
<BODY>
HalloWelt Program says:
<APPLET CODE="HalloWelt.class" WIDTH=600 HEIGHT=100>
</APPLET>
</BODY>
</HTML>
import java.applet.*;
import java.awt.*;
public class HalloWelt extends Applet {
public void paint(Graphics g) {
g.drawString("Hallo, Welt!", 100, 50);
}
}JavaScript ist ein Skriptsprache, die insbesondere in HTML-Dateien verwendet wird. Der nachfolgende Kode kann in HTML-Quelltext eingebaut werden:
<script language="javascript">
function HalloWelt()
{
javascript: alert("Hallo, Welt!");
}
</script>
<a href="javascript:this.location()"
onclick="javascript:HalloWelt();">Hallo Welt Example</a>An easier method uses JavaScript implicitly, calling the reserved alert function. Cut and paste the following line inside the <BODY> .... </BODY> HTML tags.
<a href="#" onclick="alert('Hallo, Welt!')">Hallo Welt Example</a>An even easier method involves using popular browsers' support for the virtual 'javascript' protocol to execute JavaScript code. Enter the following as an Internet address (usually by pasting into the address box):
javascript:alert('Hallo, Welt!') <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<box align="center">
<label value="Hallo, Welt!" />
</box>
</window>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<TITLE>Hallo, Welt!</TITLE>
</HEAD>
<BODY>
Hallo, Welt!
</BODY>
</HTML> /font /Courier findfont 24 scalefont
font setfont
100 100 moveto
(Hallo Welt!) show
showpage \font\HW=cmr10 scaled 3000
\leftline{\HW Hallo Welt}
\byeHallo, Welt!
oder in hexadezimaler Schreibweise:
48 65 6C 6C 6F 2C 20 77 6F 72 6C 64 21
Von "http://de.wikipedia.org/wiki/Hallo_Welt"
Diese
Seite wurde zuletzt geändert um 17:14, 19. Dez 2003. Diese Seite
ist unter der GNU FDL verfügbar.