欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

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

发布时间:2025/3/15 编程问答 46 豆豆
生活随笔 收集整理的这篇文章主要介绍了 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

总结

以上是生活随笔为你收集整理的a开头的计算机语言,我们刚开始接触计算机语言大多从Hello world 开始的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。