a开头的计算机语言,我们刚开始接触计算机语言大多从Hello world 开始

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

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

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!')

XUL

http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

文档格式

ASCII

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!

PostScript

/font /Courier findfont 24 scalefont

font setfont

100 100 moveto

(Hello world!) show

showpage

TeX

\font\HW=cmr10 scaled 3000

\leftline{\HW Hello world}

\bye

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值