cÅжϺº×Ö
#include <windows.h>
int IsGB(PTSTR pText);
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
static TCHAR szText[] = {TEXT ("i·þ,ÁË¡£u£ù")} ;
PTSTR pText;
int i;
unsigned char sqChar[20];
pText=szText;
while (*pText != '\0')
{
i=IsGB(pText);
switch(i)
{
case 0:
pText++;
MessageBox (NULL, TEXT ("·¢ÏÖÊý×Ö¡¢Ó¢ÎÄ×Ö·û»òÓ¢Îıêµã"), TEXT ("Hello"), 0);
break;
case 1:
pText++;
pText++;
MessageBox (NULL, TEXT ("·¢ÏÖÈ«½Ç×Ö·û"), TEXT ("Hello"), 0);
break;
case 2:
pText++;
pText++;
MessageBox (NULL, TEXT ("·¢ÏÖºº×Ö"), TEXT ("Hello"), 0);
break;
}
}
return 0 ;
}
int IsGB(PTSTR pText)
{
unsigned char sqChar[20];
sqChar[0]=*pText;
if (sqChar[0]>=0xa1)
if (sqChar[0]==0xa3)
return 1; //È«½Ç×Ö·û
else
return 2; //ºº×Ö
else
return 0; //Ó¢ÎÄ¡¢Êý×Ö¡¢Ó¢Îıêµã
}
Ïà¹ØÎĵµ£º
DllImportËùÔÚµÄÃû×Ö¿Õ¼ä using System.Runtime.InteropServices;
[DllImport("User32.dll")]
public extern static System.IntPtr GetDC(System.IntPtr hWnd);
private void button19_Click(obj ......
×óÖµÐÔ£¨lvalueness£©ÔÚC/C++ÖÐÊDZí´ïʽµÄÒ»¸öÖØÒªÊôÐÔ¡£Ö»ÓÐͨ¹ýÒ»¸ö×óÖµ±í´ïʽ²ÅÄÜÀ´ÒýÓü°¸ü¸ÄÒ»¸ö¶ÔÏó£¨object£©µÄÖµ¡££¨Ä³Ð©Çé¿öÏ£¬ÓÒÖµ±í´ïʽҲÄÜÒýÓã¨refer£©µ½Ä³Ò»¸ö¶ÔÏ󣬲¢ÇÒ¿ÉÄܼä½ÓÐ޸ĸöÔÏóµÄÖµ£¬ºóÊö£©¡£
ºÎν¶ÔÏó£¿Èç¹ûûÓÐÃ÷ȷ˵Ã÷£¬ÕâÀï˵µÄ¶ÔÏ󣬺ÍÏÁÒåµÄÀà/¶ÔÏó£¨class/object£© ......
1¡¢´ÓN¸öÊýÖÐÑ¡³ön¸ö×î´óµÄÊý£¬Ð´³ö˼·ºÍʵÏÖ¡£
¡¶±à³ÌÖ®ÃÀ¡·ÉÏÓн²Õâ¸öËã·¨µÄÉè¼ÆÓë˼·¡£
ÎÒÕâÀï¼òµ¥Ð´¼¸¸ö˼·£º
£¨a£©Èç¹ûNÄÜÔÚÖ÷´æÖÐÒ»´Î¶ÁÈ룬ÔòÏȽøÐпìÅÅ£¬È»ºóÔÙȡǰn¸öÊý¡£Ëã·¨¸´ÔÓ¶È£ºO(NlogN).
£¨b£©Èç¹ûN·Ç³£´ó£¬¼ÙÉè²»ÄÜÒ»´Î¶ÁÈëÄڴ棬²¢ÇÒn²»ÊǺܴóµÄ»°£¬¿ÉÒÔά»¤Ò»¸ön¸öÔªËØµÄÓÐÐò¶ÓÁУ¬¶ÓÁÐÖж¼ÊÇÿ¸ ......