以下程序在C++BUILDER中测试肆态通过。氏罩
//---------------------------------------------------------------------------
#include <windows.h>
#include <stdio.h>
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM)
WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
static TCHAR szAppName[]=TEXT("HWCPcn")
static TCHAR szClassName[]=TEXT("HWICPcn")
HWND hwnd
MSG msg
WNDCLASS wndclass
wndclass.style=CS_HREDRAW | CS_VREDRAW
wndclass.lpfnWndProc =WndProc
wndclass.cbClsExtra =0
wndclass.cbWndExtra =0
wndclass.hInstance =hInstance
wndclass.hIcon =LoadIcon(NULL,IDI_APPLICATION)
wndclass.hCursor =LoadCursor(NULL,IDC_ARROW)
wndclass.hbrBackground =(HBRUSH)GetStockObject(WHITE_BRUSH)
wndclass.lpszMenuName =NULL
wndclass.lpszClassName =szClassName
if (!RegisterClass(&wndclass)) {
MessageBox(NULL,TEXT("wiki.cprogram.cn"),szAppName,MB_ICONINFORMATION)
return 0
}
hwnd=CreateWindow(szClassName,TEXT("THE C PROGRAM"), WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,hInstance,NULL)
ShowWindow(hwnd,nCmdShow)
UpdateWindow(hwnd)
while (GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg)
DispatchMessage(&msg)
}
return msg.wParam
}
LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
HDC hdc
PAINTSTRUCT ps
RECT rect
switch (message) {
case WM_PAINT:
hdc=BeginPaint(hwnd,&ps)
GetClientRect(hwnd,&rect)
DrawText(hdc,TEXT("www.CPROGRAM.CN"),-1,&rect,DT_SINGLELINE|DT_CENTER|DT_VCENTER)
EndPaint(hwnd,&ps)
return 0
case WM_CREATE:
MessageBox(NULL,"Hello","Cprogram.cn",MB_OK)
return 0
case WM_DESTROY:
PostQuitMessage(0)
return 0
}
return DefWindowProc(hwnd,message,wParam,lParam)
}
//---------------------------------------------------------------------------
您好!很高兴为您解答问题,以下是我为您提供的解答内容:1、如果算法描述已经很彻底了,只要补充变量定义,等配则语言细节就可以,把算法培槐棚描述转化为各种编程语言了。如果只是泛泛而论,自己去把算法转换成伪代码描述,或者流程图之类的,然后再用C语言实现。
2、明毕算法只是一种处理数据的一种思想(常用伪代码表示),理解这种思想之后,再用计算机语言表达出来,如果C语法不过关,是很难完成程序的编写,所以C语言本身也要认真学习才行。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)