Hello World
这个例程是从Kernighan & Ritchie 合著的《The C Programme Language》开始有的,因为它的简洁,实用,并包含了一个程序所应具有的一切,因此为后来的些类书的作者提供了范例,一直待续到今。
我们刚开始接触计算机语言大多从Hello world 开始,下面是各种语言的Hello world program:
as400的RPGLE语言:
D Vc_Hello s 100A
C Eval Vc_Hello = 'Hello World!'
C DSPLY Vc_Hello
AKA 控制台:ABC语言的Hello World程序 WHILE (1=1) :
WRITE "Hello World "
Ada语言的Hello World程序 with Ada.Text_Io; use Ada.Text_Io;
procedure Hello is
begin
Put_Line ("Hello, world!");
end Hello;
AmigaE语言的Hello World程序 PROC main()
WriteF('Hello, World!')
ENDPROC
APL语言的Hello World程序 'Hello World'
Assembly语言的Hello World程序 Accumulator-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 asm
MSG: .ASCIIZ "Hello, world!"
LDX #0
LDA MSG,X ; load initial char
@LP: JSR $FFD2 ; CHROUT CBM KERNAL
INX
LDA MSG,X
BNE @LP
RTS
Accumulator/Index microcoded machine: Data General Nova, RDOS
See the example section of the Nova article.
Expanded accumulator machine: Intel x86, MS-DOS, TASM
MODEL SMALL
IDEAL
STACK 100H
DATASEG语言的Hello World程序 MSG DB 'Hello, world!$'
CODESEG语言的Hello World程序 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!/
.END HELLO
CISC: 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=#io$_writevblk,-
iosb=out_iosb,-
p1=msg,-
p2=#13
blbc r0,error
$exit_s ; normal exit
error: halt ; error condition
.end start
AWK语言的Hello World程序 BEGIN { print "Hello, world!" }
BASIC语言的Hello World程序 PRINT "HELLO WORLD"
MS BASIC语言的Hello World程序 (traditional, unstructured)
10 PRINT "Hello, world!"
20 END
TI-BASIC语言的Hello World程序 isp "Hello, world!"
Structured BASIC语言的Hello World程序 print "Hello, world!"
BCPL语言的Hello World程序 GET "LIBHDR"
LET START () BE
$(
WRITES ("Hello, world!*N")
$)
C语言的Hello World程序 #include <stdio.h>
int main(void)
{
printf("Hello, world!\n");
}
C++语言的Hello World程序 #include <iostream>
using namespace std;
int main()
{
cout << "Hello, world!" << endl;
return 0;
}
C#语言的Hello World程序 class HelloWorldApp
{
public static void Main()
{
System.Console.WriteLine("Hello world!");
}
}
Clean语言的Hello World程序 module hello
Start :: String
Start = "Hello, world"
CLIST语言的Hello World程序 PROC 0
WRITE Hello, World!
COBOL语言的Hello World程序 IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
DISPLAY "Hello, world!".
STOP RUN.
Common Lisp语言的Hello World程序 (format t "Hello world!~%")
Eiffel语言的Hello World程序 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语言的Hello World程序 -module(hello).
-export([hello_world/0]).
hello_world() -> io:fwrite("Hello, world!\n").
Forth语言的Hello World程序 ." Hello, world!" CR
Fortran语言的Hello World程序 PROGRAM HELLO
WRITE(*,10)
10 FORMAT('Hello, world!')
STOP
END
Haskell语言的Hello World程序 module HelloWorld (main) where
main = putStr "Hello World\n"
Iptscrae语言的Hello World程序 ON ENTER {
"Hello, " "World!" & SAY
}
Java语言的Hello World程序 public class Example{
public static void main(String[] args) {
System.out.println("Hello, world!");
}
}
Logo语言的Hello World程序 print [hello world!]
Lua语言的Hello World程序 print "Hello, world!"
MIXAL语言的Hello World程序 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语言的Hello World程序 @echo off
echo Hello, world!
OCaml语言的Hello World程序 let _ =
print_endline "Hello world!";;
OPL
PROC hello:
PRINT "Hello, World"
ENDP
Pascal语言的Hello World程序 program hello_world;
begin
writeln('Hello World!');
end.
Perl语言的Hello World程序 print "Hello, world!\n";
PHP语言的Hello World程序 <?php
print("Hello, world!");
?>
Pike语言的Hello World程序 #!/usr/local/bin/pike
int main() {
write("Hello, world!\n");
return 0;
}
PL/I语言的Hello World程序 Test: procedure options(main);
declare My_String char(20) varying initialize('Hello, world!');
put skip list(My_String);
end Test;
Python语言的Hello World程序 print "Hello, world!"
REXX语言的Hello World程序 also NetRexx and Object REXX
say "Hello, world!"
Ruby语言的Hello World程序 print "Hello, world!\n"
Sather语言的Hello World程序 class HELLO_WORLD is
main is
#OUT+"Hello World\n";
end;
end;
Scheme语言的Hello World程序 (display "Hello, world!")
(newline)
sed语言的Hello World程序 (requires at least one line of input)
sed -ne '1s/.*/Hello, world!/p'
Self语言的Hello World程序 'Hello, World!' uppercase print.
Smalltalk语言的Hello World程序 Transcript show: 'Hello, world!'
SML语言的Hello World程序 print "Hello, world!\n";
SNOBOL语言的Hello World程序 OUTPUT = "Hello, world!"
END
SQL语言的Hello World程序 create table MESSAGE (TEXT char(15));
insert into MESSAGE (TEXT) values ('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语言的Hello World程序 puts "Hello, world!"
Turing语言的Hello World程序 put "Hello, world!"
UNIX-style shell语言的Hello World程序 echo 'Hello, world!'
Romanian pseudocode语言的Hello World程序 (UBB Cluj-Napoca)Algoritmul Salut este:
fie s:="Hello, world";
tipareste s;
sf-Salut
传统图形界面应用开发工具: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语言的Hello World程序 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 windowClosing(WindowEvent e)
{
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
QApplication app语言的Hello World程序 (argc, argv);
HelloWorld helloWorld;
app.setMainWidget(&helloWorld);
helloWorld.show();
return app.exec();
}
Visual Basic语言的Hello World程序 1.信息框
MsgBox "Hello, world!"
2.输出到窗体
Print "Hello, world!"
Windows API (in C)语言的Hello World程序 #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 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, "Hello, world!", 13);
EndPaint(hwnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, message, wParam, lParam);
}
return 0;
}
基于web图形用户界面:Java applet语言的Hello World程序 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.
οnclick="javascript:helloWorld();">Hello World Example
An easier method uses JavaScript implicitly, calling the reserved alert function. Cut and paste the following line inside the .... HTML tags.
Hello World Example
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('Hello, world!')
文档格式:
ASCII语言的Hello World程序 The following sequence of characters, expressed in hexadecimal notation (with carriage return and newline characters at end of sequence):
48 65 6C 6C 6F 2C 20 77 6F 72 6C 64 21 0D 0A
HTML语言的Hello World程序 <HTML>
<body>
<p>Hello, world!</p>
</body>
</HTML>
PostScript语言的Hello World程序 /font /Courier findfont 24 scalefont
font setfont
100 100 moveto
(Hello world!) show
showpage
TeX语言的Hello World程序 \font\HW=cmr10 scaled 3000
\leftline{\HW Hello world}
\bye
LaTeX语言的Hello World程序 \documentclass{article}
\begin{document}
Hello, world!
\end{document}
批处理语言的Hello World程序 echo Hello World!
易语言的Hello World程序 窗体程序:
.子程序 __启动窗口_创建完毕
信息框 (“Hello, world!”, 0, )
控制台程序:
.版本 2
.程序集 程序集1
.子程序 _启动子程序, 整数型, , 本子程序在程序启动后最先执行
标准输出 (, “Hello World!”) ' 输出Hello World
标准输入 () ' 达到暂停程序的效果以便于查看Hello World
返回 (0) ' 可以根据您的需要返回任意数值
O语言的Hello World程序 O汇编语言的Hello World程序
.包含文<*oasm32.oah>
.包含文<*user32.oah>
.包含文<*kernel32.oah>
.引用库<*user32.lib>
.引用库<*kernel32.lib>
.代码段
{
入口 主函数()
{
提示框(0,&"Hello, world!",&"hello world!",0)
退出进程(0);
}
}
O中间语言的Hello world程序
.包含文<*视窗32.omh>
入口 主函数()
{
提示框(0,取地址 "Hello world!",取地址 "",0);
退出进程(0);
}
GML语言的Hello world程序 draw_text ( 0 , 0 , "Hello World")
javascript语言的Hello World程序 <script language="javascript">
alert('hello word!');
</script>
转载于:https://blog.51cto.com/apprentice/1360719
相关文章:

POJ 1144 Network (求割点)
题意: 给定一幅无向图, 求出图的割点。 割点模板:http://www.cnblogs.com/Jadon97/p/8328750.html 分析: 输入有点麻烦, 用stringsteam 会比较简单 #include<cstdio> #include<iostream> #include<queu…
mongoose简单使用
介绍&安装 官网:http://www.mongoosejs.net/ npm i -S mongoose 使用 1.连接mongodb&创建模型 var mongoose require(mongoose)//1、连接mongodb mongoose.connect(mongodb://localhost/test)//2、设置文档结构var userSchema new mongoose.Schema…

Codeforces Round #563 (Div. 2)/CF1174
Codeforces Round #563 (Div. 2)/CF1174 CF1174A Ehab Fails to Be Thanos 其实就是要\(\sum\limits_{i1}^n a_i\)与\(\sum\limits_{n1}^{2n}a_i\)差值最大,排一下序就好了 CF1174B Ehab Is an Odd Person 一个显然的结论就是如果至少有一个奇数和一个偶数ÿ…

Enterprise Architect 中文经典教程
一、Enterprise Architect简介Enterprise Architect是一个对于软件系统开发有着极好支持的CASE软件(Computer Aided Software Engineering)。EA不同于普通的UML画图工具(如VISIO),它将支撑系统开发的全过程。在需求分析…

[WebDev]Web 开发与设计师速查手册大全
Cheat Sheet 一词在中文中并没有很贴切的对译,大概是考试作弊条一类的东西,这要求 Cheat Sheet 必须短小精悍又覆盖广泛,作为 Web 开发与设计师,免不了在工作时查询大量资料,某个 Web 色值,某个 JavaScript…

android中的回调
1、引子 android中的回调最经典的就是点击事件设置监听(一般通过switch(v.getId()))这里写个最主要的 btn_rigister.setOnClickListener(new View.OnClickListener() {Overridepublic void onClick(View view) {// TODO log in} }…

nodejs回调函数理解
回调实例 问题:想要得到一秒后 计算出的结果 //错误写法function add(x,y) {console.log(1);setTimeout(function () {console.log(2);var ret x y;return ret;},1000);console.log(3)}console.log(add(10,20))添加一个函数作为参数,将计算出来的结果传…

C# 运算符的优先级
优先级由高到低 --(用作前缀); ; -(一元); () ; ! ; ~ * ; / ; % ; - <<; >> < ; > ; < ; > ; ! & ^ | && || ; * ; / ; % ; ; - ; << ; >> ; & ; ^ ;| --(作后缀);转载于:https://www.cnblogs.com/h…

Service Manager 的系统要求
以下各节包含有关 Service Manager 的硬件和软件要求的信息,并基于以下环境。System Center Service Manager 2010 已经过测试,并且正在使用一个支持 80 到 100 个并发 Service Manager 控制台的 Service Manager 管理服务器,测试根据本指南中…

读Lodash源码——chunk.js
The time is out of joint: O cursed spite, That ever I was born to set it right. --莎士比亚 最艰难的第一步 最近学习遇到了些障碍,浮躁浮躁又浮躁。很难静下心来做一件事,北京的寒风也难以让我冷静下来. 之前一直很想找个源码读读,太懒…

使用相对路径时,./、../、../../,代表的什么?
./ 当前目录。../ 父级目录。/ 根目录。 举个栗子: 页面引入js、css等文件: 1.如果about.jsp页面想引入common.css文件: 以about.jsp为基点寻找 直到 和static文件在同一级; 2.如果引入的外部css、js文件又引入image等时&#x…

asyncawait
简单理解 async async就是将方法变成异步 await 是等待异步方法的执行完成,可以获取异步方法里面的数据,但必须得用在异步方法(async)里面 创建异步方法 定义一个普通方法,返回值是一个字符串 function getData() {return 这是一个数据;}co…

引起路由器重启的“元凶”
文章出处:www.net1980.com在我们的日常维护中,偶然会遇到一些路由器自动重启的故障。那么大家都会自然地猜测到是否设备已经运行一段长时间,设备稳定性开始减低。或者可能有工作人员把电源拨松了,又或者设备负荷过重等原因。那么究…

python csv.reader参数指定
转载于:https://www.cnblogs.com/mahailuo/p/8375997.html

xBIM 实战01 在浏览器中加载IFC模型文件
系列目录 【已更新最新开发文章,点击查看详细】 一、创建Web项目打开VS,新建Web项目,选择 .NET Framework 4.5选择一个空的项目新建完成后,项目结构如下: 二、添加webServer访问文件类型由于WexXplorer 加载的是 .w…

node 判断文件夹是否存在
判断文件夹是否存在 let filePath path.join(__dirname,../)/download_tmp/fs.exists(filePath, function(exists) {if(!exists){fs.mkdir(filePath,function (err) {if(err){console.log(err)}})}});生成excle文件到本地 业务要求:生成excle文件到本地的路径 #安装…

IE9 : DOM Exception: INVALID_CHARACTER_ERR (5)
以下代码在IE8下运行通过,在IE9中出错:document.createElement(<iframe id"yui-history-iframe" src"../../images/defaults/transparent-pixel.gif" style"position:absolute;top:0;left:0;width:1px;height:1px;visibilit…

数字家庭开发者中心
数字家庭开发者中心 http://www.adobe.com/devnet/devices/digital_home.html转载于:https://www.cnblogs.com/kobo/archive/2010/07/06/1772136.html

LeetCode 1021:Remove Outermost Parentheses
C语言 char * removeOuterParentheses(char * S){int len strlen(S);int j 0;int sum 0;for(int i 0; i < len; i){if (S[i] (){sum 1;}else if (S[i] )){sum - 1;}if (S[i] ( && sum > 1){S[j] (;j;}else if (S[i] ) && sum > 0){S[j] );…

Koa实现下载excel
Koa实现下载excel #安装 node-xlsx npm install node-xlsx --save实现思路:将生成的excel文件流返回到前端 routes router.get(/mp/push_excle, async (ctx, next) > {await Push.pushGroupExcel(ctx).then(function(res) {// let path resctx.set(Content-Ty…

使用 雨林木风 Ghost XP SP3 装机版 YN9.9 安装 Win7 (SP1)
下载Win7 SP1一段时间了,一直没来安装,今天来安装,由于没有DVD刻录机,不能做成光盘安装发现还不是那么方便。后面想到用雨林木风PE光盘来安装,一步一步 【下面假设是将Win7 (SP1) 将要安装到 C: 盘中】 首先使用 雨林木…

2010中国大陆×××指南,满足你的欲望!
中国大陆指南,满足你的欲望! 川渝--椒麻鸡,怪味鸡,棒棒鸡,口水鸡,罐罐鸡,辣子鸡 广东--太爷鸡,越秀鸡,花雕鸡,板栗焖仔鸡,客家盐局鸡,湛江鸡,清远鸡广西--桂林黄焖鸡,梧州纸包鸡,啤酒鸡,泉水鸡 山东--沂蒙光棍鸡,德州扒鸡 云南--汽锅鸡,柴把鸡 贵州-…

iframe元素內嵌页面如何去掉继承的html及body背景色/背景图片
【1】去掉背景色:添加如左的样式 filter:Chroma(Colorwhite); <iframe name"Conframe" id"Conframe" name"back" style"background:#2397E2filter:Chroma(Colorwhite)"></iframe> 转载于:https://www.cn…

ListView style
步骤一:在使用的ListView的activiey里使用android:theme“style/Theme的名字” 步骤二:创建Themes.xml 在Themes.xml里定义的使用的样式。如: 步骤三:在themes.xml使用了styles.xml定义的listView的属性,创…

数据结构和算法-栈
栈可以分为 顺序栈: 数组实现链式栈: 链表实现空间复杂度 栈的空间复杂度: 有一个n个元素的栈, 在入栈和出栈过程中, 只需要存储一个临时变量存储空间, 所以空间复杂度是O(1) 并不是说栈有n个元素, 空间复杂度就是O(n), 而是指除了原本的空间外, 算法需要的额外空间 栈要满足后…

nodejs 根据坐标 标记图片上的姓名列
1.安装 npm install canvas或者使用cnpm install canvas var { createCanvas, loadImage } require(canvas);function drawImageRemark(imgurl,rects,res) {loadImage(imgurl).then((image) > {console.log(image.width)const canvas createCanvas(image.width, image.h…

以太网控制芯片DM9000在2440裸机上终于能正确接收数据了(源代码工程已经上传)...
以太网控制芯片DM9000在2440裸机上终于能正确接收数据了(源代码工程已经上传) (411.47 K) 该附件被下载次数 168 弄了几天DM9000了,一直不能正确接收数据,郁闷了几天,现在终于行了,高兴一下。 参考了这篇…

ajax post 参数说明
转载于:https://www.cnblogs.com/LuoEast/p/8395086.html

Struts2 2.5版本新配置filter-class
在web.xml 默认代码: <?xml version"1.0" encoding"UTF-8"?> <web-app xmlns"http://xmlns.jcp.org/xml/ns/javaee"xmlns:xsi"http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation"http://xmln…

正则表达式收集
允许为纯英文,数字和汉字及其组合 /^[a-z0-9A-Z\u4e00-\u9fa5]$/ 微信账号 /^(?!_;)(?!.*?_$)[a-zA-Z0-9_;-]{4,23}$/ openid由28位数字或下划线组成 /^(?!_)(?!.*?_$)[a-zA-Z0-9_-]{28}$/