After the meal, I will review our familiar "Hello World Program"

zhaozj2021-02-16  56

We just started to contact the computer language from Hello World, and demonstrate Hello World Program in a variety of languages:

AKA console

ABC

While (1 = 1): Write "Hello World"

Ada with ada.text_io; use ada.text_io; procedure hello is beginning PUT_LINE ("Hello, World!"); End Hello;

Amigae Proc Main () Writef ('Hello, World!') Endproc

APL 'Hello World'

Assembly Language Acumulator-Only Architecture: DEC PDP-8, PAL-III Assembler See The Example Section of The PDP-8 Article.

Accumulator Index Register Machine: MOS 6502, CBM, CA65 ASG: .asciiz "Hello, World!" LDX # 0 LDA MSG, X; Load Initial Char @lp: JSR $ FFD2; Chrout CBM Kernal Inx LDA MSG, X BNE @LP RTSAccumulator / Index microcoded machine: Data General Nova, RDOS See the example section of the Nova article Expanded accumulator machine:. '! Hello, world $' Intel x86, MS-DOS, TASM MODEL SMALL IDEAL STACK 100H dATASEG MSG DB CODESEG Mov AX, @Data MoV DS, AX MOV DX, OFFSET MSG MOV AH, 09H; DOS: OUTPUT ASCII $ STRING INT 21H MOV AX, 4C00H INT 21h End

General-purpose-register Cisc: DEC PDP-11, RT-11, Macro-11.mcall .regdef, .ttyout, .exit .regdef Hello: MOV # msg, R1 MOVB (R1), R0 loop: .ttyout MOVB (R1), R0 Bne loop .exit msg: .asciz / hello, world! / .Nd Hellocisc: VAX, VMS, Macro32.title Hello Term_name: .ascid / sys $ input / term_chan: .blkw 1 out_iosb: .blkq 1 Msg: .asciz / hello, world! / .entry Start, 0; Establish a Channel for Terminal I / O $ assign_s devnam = term_name, - CHAN = Term_Chan BLBC R0, ERROR; Queue the I / O Request $ qio_s chan = term_chan , - func = # o $ _Writevblk, - iOSB = OUT_IOSB, - P1 = MSG, - P2 = # 13 BLBC R0, Error $ EXIT_S; NORMAL EXIT Error: Halt; Error Condition .nd Startawk Begin {Print "Hello, World! "}

Basic MS Basic 10 Print "Hello, World!" 20 End Ti-Basic ISP "Hello, World!" Structured Basic Print "Hello, World!" BCPL Get "libhdr" let Start () BE $ (Writes ("Hello, World! * N") $)

C #include

INT main (void) {Printf ("Hello, World! / N"); return 0;}

C #include

Using namespace std;

INT main () {cout << "Hello, World!" << endl; return 0;

C # class helloworldapp {public static void main () {system.console.writeline ("Hello, World!");}}

Clean Module Hello Start :: string start = "Hello, World"

Clist proc 0 WRITE HELLO, World! Cobol Identification Division. Program-id. Hello-World. Environment Division. Data Division. Procedure Division. Display "Hello, World!". Stop Run.

Common Lisp (Format T "Hello World! ~%)

Eiffel Class Hello_World Creation Make Feature Make Is 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 (elder university courses) Program Hello Write (*, 10) 10 Format ('Hello, World!') Stop end

Haskell Module HelloWorld (Main) Where main = Putstr "Hello World / N"

Iptscrae on Enter {"Hello," World! "& Sign}

Java public class hello {public static void main (string [] args) {system.out.println ("Hello, World!");}}

Logo Print [Hello World!]

Lua Print "Hello, World!"

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

MSDOS Batch @echo off echo hello, world!

Ocaml let _ = print_endline "Hello World!" ;; OPL Proc Hello: Print "Hello, World" Endp Pascal Program Hello; Begin Writeln ('Hello, World!'); End. Perl Print "Hello, World! / N" ; PHP

Print ("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 (20) Varying Initialize ('Hello, World!'); PUT SKIP LIST (MY_STRING); End Test;

Python Print "Hello, World!"

REXX, Also NetRexx and Object Rexx Say "Hello, World!"

Ruby Print "Hello, World! / N"

Sather class hello_world is main is # Out "Hello WORLD / N"; end;

Scheme (Display "Hello, World!") (NewLine)

Sed (Requires At Least One Line Of Input) Sed -ne '1S /.*/ Hello, World! / P'

Self 'Hello, World!' Uppercase Print.

Smalltalk Transcript show: 'Hello, World!'

SML Print "Hello, World! / N";

Snobol Output = "Hello, World!" End

SQL CREATE TABLE Message (Text Char (15)); Insert Into Message ('Hello, World!'); Select Text from Message; Drop Table Message; OR, More Simply Print 'Hello, World.'

Staroffice Basic Sub Main Print "Hello, World" End Sub

TCL PUTS "Hello, World!"

Turing Put "Hello, World!"

UNIX-style shell echo 'hello, world!'

Romanian pseudocode (UBB CLUJ-NAPOCA) Algoritmul Salut Este: Fie s: = "Hello, World"; TipareSTe S; SF-SALUT Traditional Graphics Application Development Tool C Bindings for GTK Graphics Toolkit #include

#include

#include

#include

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: Lot (* 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;

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; java.awt .Insets INS = this.getinsets (); g.drawstring ("Hello, World!", INS.LEFT 25, INS.TOP 25);} public static void main (string args []) {Helloframe fr = New Helloframe ("Hello"); fr.addwindowlistener (new windowadapter () {public void window {system.exit (0);}}); fr.setresizable (true); fr.setsize (500, 100) Fr.setvisible (TRUE);}} Qt Toolkit (In C ) #include

#include

#include

#include

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 ());} HelloWorld :: ~ HelloWorld () {} void HelloWorld :: HandleButtonClicked () {std :: COUT << "Hello, World!" << std :: endl;} int main (int Argc, char * argv [qapplication app (argc, argv); helloworld HelloWidGet; app.setmainwidget (& helloworld); HelloWorld.show (); return app.exec ();

Visual Basic MsgBox "Hello, World!"

Windows API (In C) #include

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 Na me "", // 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, " Hello, World! ", 13); Endpaint (HWND, & PS); Break; Case WM_DESTROY: PostquitMessage (0); Break; Default: Return DefWindowProc (hwnd, message, wparam, lparam);} Return 0;} Based on web graphics User Interface Java Applet Java Applets Work in Conjunction with HTML Files. HelloWorld Program Says:

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

Import java.applet. *; import java.awt. *; public class helloworld extends applet {public void Paint (GRAPHICS G) {g.drawstring ("Hello, World!", 100, 50);}}

JavaScript, aka ECMAScript JavaScript is a scripting language used in HTML files. To demo this program Cut and Paste the following code into any HTML file.