各种语言的HelloWorld编程
更新时间:2023-12-16 21:19:01 阅读量: 教育文库 文档下载
hello world
百科名片
C和C++“hello world”程序
hello world作为所有编程语言的起始阶段,占据着无法改变的地位,所有中/英/法/德/美……版本的编程教材中,hello world总是作为第一个TEST记录于书本之中,所有的编程第一步就在于此了!经典之中的经典!hello world! 目录
简介 AKA 控制台: 传统图形界面应用开发工具: 基于web图形用户界面: 展开 编辑本段
简介
这个例程是从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 \
Ada语言的Hello World程序
with Ada.Text_Io; use Ada.Text_Io; procedure Hello is begin
Put_Line (\ 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 \ 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 \
BASIC语言的Hello World程序
PRINT \
MS BASIC语言的Hello World程序
(traditional, unstructured) 10 PRINT \ 20 END
TI-BASIC语言的Hello World程序
isp \
Structured BASIC语言的Hello World程序
print \
BCPL语言的Hello World程序
GET \ LET START () BE $(
WRITES (\ $)
BF语言的Hello World程序
++++++++++[>+++++++>++++++++++>+++>+<<<<-] >++.>+.+++++++..+++.>++.<<+++++++++++++++. >.+++.------.--------.>+.>.
C语言的Hello World程序
#include
printf(\ }
C++语言的Hello World程序
#include
cout << \ return 0; }
C#语言的Hello World程序
class HelloWorldApp {
public static void Main() {
System.Console.WriteLine(\ } }
Clean语言的Hello World程序
module hello Start :: String Start = \
CLIST语言的Hello World程序
PROC 0
WRITE Hello, World!
COBOL语言的Hello World程序
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO-WORLD. ENVIRONMENT DIVISION. DATA DIVISION. PROCEDURE DIVISION. DISPLAY \ STOP RUN.
Common Lisp语言的Hello World程序
(format t \
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(\ }
public static void main(String args []) {
HelloFrame fr = new HelloFrame(\ 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 \ 2.输出到窗体 Print \
Windows API (in C)语言的Hello World程序
#include
LRESULT CALLBACK WindowProcedure(HWND, UINT, WPARAM, LPARAM); char szClassName[] = \ 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 \
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, \ 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(\ } }
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. onclick=\
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程序
Hello, world!
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,&\ 退出进程(0); } }
O中间语言的Hello world程序 .包含文<*视窗32.omh> 入口 主函数() {
提示框(0,取地址 \取地址 \ 退出进程(0); }
GML语言的Hello world程序
draw_text ( 0 , 0 , \
javascript语言的Hello World程序
.包含文<*kernel32.oah> .引用库<*user32.lib> .引用库<*kernel32.lib> .代码段 {
入口 主函数() {
提示框(0,&\ 退出进程(0); } }
O中间语言的Hello world程序 .包含文<*视窗32.omh> 入口 主函数() {
提示框(0,取地址 \取地址 \ 退出进程(0); }
GML语言的Hello world程序
draw_text ( 0 , 0 , \
javascript语言的Hello World程序
正在阅读:
各种语言的HelloWorld编程12-16
2011年仁怀市人民政府工作报告01-22
旺旺水果店教案09-28
除害处理设施及相关材料12-06
结婚前准备工作日程安排05-11
漾濞职称论文发表网-二次支护高地压深井论文选题题目04-15
劳务公司内部管理规章制度03-08
综合测试楼可研09-22
- exercise2
- 铅锌矿详查地质设计 - 图文
- 厨余垃圾、餐厨垃圾堆肥系统设计方案
- 陈明珠开题报告
- 化工原理精选例题
- 政府形象宣传册营销案例
- 小学一至三年级语文阅读专项练习题
- 2014.民诉 期末考试 复习题
- 巅峰智业 - 做好顶层设计对建设城市的重要意义
- (三起)冀教版三年级英语上册Unit4 Lesson24练习题及答案
- 2017年实心轮胎现状及发展趋势分析(目录)
- 基于GIS的农用地定级技术研究定稿
- 2017-2022年中国医疗保健市场调查与市场前景预测报告(目录) - 图文
- 作业
- OFDM技术仿真(MATLAB代码) - 图文
- Android工程师笔试题及答案
- 生命密码联合密码
- 空间地上权若干法律问题探究
- 江苏学业水平测试《机械基础》模拟试题
- 选课走班实施方案
- HelloWorld
- 各种
- 语言
- 编程
- 铁道工程
- 10古诗晨诵教案
- 第一讲 函数的基本性质(4h)
- 数字电子技术基础试题及答案
- 宿迁市人民政府关于促进我市全社会研发投入快速增长的意见
- 演马庄矿一月份防突措施计划
- 液压试题1及答案
- 政策执行视角下的广东省援外医疗队派遣难问题研究
- 税务管理-30个税务稽查热点问题分析(一)
- 心理与精神护理期终终考试卷1
- 新概念一册Lesson 29-30 学案与练习
- 轻度脑萎缩的治疗方法
- 第四单元 小数加法和减法的计算法则
- 室外停车场管理规定
- 新世纪大学英语3综合教程课后习题
- 生活中的经济学
- 病房呼叫系统(带程序)
- 市场容量与市场规模的区别
- 2019-2020年高中语文必修四2.4《雨霖铃》word教案
- 集体备课《雪地里的小画家》教学设计(1)