各种语言的HelloWorld编程(3)

2020-02-21 15:46

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程序


各种语言的HelloWorld编程(3).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:商务礼仪规范

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: