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 开始的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: android 屏幕坐标色彩,Andro
- 下一篇: svn合并分支到主干_谈谈代码分支管理