Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

¿ØÖÆÌ¨³ÌÐòCtrl +C Í˳ö

[DllImport("kernel32.dll",SetLastError=true)]
[return: MarshalAs( UnmanagedType.Bool )]
static extern bool AllocConsole();
[DllImport("kernel32.dll",SetLastError=true)]
[return: MarshalAs( UnmanagedType.Bool )]
static extern bool FreeConsole();
// Delegate type to be used as the Handler Routine for SCCH
delegate bool ConsoleCtrlDelegate(CtrlTypes CtrlType);
// Enumerated type for the control messages sent to the handler routine
enum CtrlTypes: uint
{
    CTRL_C_EVENT=0,
    CTRL_BREAK_EVENT,
    CTRL_CLOSE_EVENT,
    CTRL_LOGOFF_EVENT=5,
    CTRL_SHUTDOWN_EVENT
}
[DllImport("kernel32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool SetConsoleCtrlHandler(ConsoleCtrlDelegate HandlerRoutine, bool Add);
private static bool ctrlHandler(CtrlTypes CtrlType)
{
    if ((CtrlType == CtrlTypes.CTRL_C_EVENT) || (CtrlType == CtrlTypes.CTRL_BREAK_EVENT))
    {
        FreeConsole();
        return true;
    }
    if (CtrlType == CtrlTypes.CTRL_CLOSE_EVENT)
        return true;
    return false;
}


Ïà¹ØÎĵµ£º

extern "C"

      ΪʲôÐèҪʹÓÃextern "C"ÄØ£¿C++Ö®¸¸ÔÚÉè¼ÆC++֮ʱ£¬¿¼Âǵ½µ±Ê±ÒѾ­´æÔÚÁË´óÁ¿µÄC´úÂ룬ΪÁËÖ§³ÖÔ­À´µÄC´úÂëºÍÒѾ­Ð´ºÃC¿â£¬ÐèÒªÔÚC++Öо¡¿ÉÄܵÄÖ§³ÖC£¬¶øextern "C"¾ÍÊÇÆäÖеÄÒ»¸ö²ßÂÔ¡£
¡¡¡¡ÊÔÏëÕâÑùµÄÇé¿ö:Ò»¸ö¿âÎļþÒѾ­ÓÃCдºÃÁ˶øÇÒÔËÐеúÜÁ¼ºÃ£¬Õâ¸öʱºòÎÒÃÇÐèҪʹÓÃÕâ¸ö¿âÎļþ£ ......

CÃüÃûϰ¹ß

ºê
È«´óд, Èç¹û±ØÒª, ÓÃÁ¬×Ö·ûÁ¬½Óµ¥´Ê
#define SIZE_LIMIT 1024
#define CONFIG_DEBUG 1
#define PRODUCT_ID 0x1123
ö¾Ù
µ¥´ÊÊ××Öĸ´óд, ²»ÓÃÁ¬×Ö·û
enum {
KeyNumLock,
KeyShift,
Key1,
KayA
} Key;
......

object c ÄÚ´æ¹ÜÀí

   ¿´ÁËϹٷ½ÎĵµµÄ¹ØÓÚobject c µÄÄÚ´æ¹ÜÀí,×ܽáÏÂ:
 
    ÔÚiphoneÖÐobject c  ÖеÄÄÚ´æ¹ÜÀíÊÇͨ¹ý¼ÆÊýÆ÷À´¹ÜÀíµÄ,ÿ¸ö¶ÔÏóÄÚ²¿¶¼ÓÐÒ»¸ö¼ÆÊýÆ÷.н¨Ò»¸ö¶ÔÏó,»òÕßÕâ¸ö¶ÔÏ󱻯äËû¶ÔÏóÒýÓÃ,¶à»áʹ¼ÆÊýÆ÷¼Ó1.Retain Ôö¼Ó¼ÆÊýÆ÷Öµ release ¼õÉÙ¼ÆÊýÆ÷Öµ.µ±¼ÆÊýÆ÷Ϊ0ʱ¶ÔÏó¾Ídeall ......

c/vc++ »·¾³Ï²»Í¬µÄÎļþ³¤¶È»ñÈ¡·½·¨

£¨Ò»£©
¶ÔÎļþ²Ù×÷ʱÓÐʱ»ñµÃÎļþµÄ´óСʱ±ØÒªµÄ.ÏÂÃæÊÇ»ñµÃÆä´óССµÄ½Ï¼òµ¥·½·¨.
#include<io.h>   //CÓïÑÔÍ·Îļþ
#include<iostream>   //for system();
using namespace std;
int main()
{
  int handle;
  handle = open("test.txt", 0x0100); //open file for rea ......

±à³ÌÇóÒ»Ôª¶þ´Î·½³Ìax2+bx+c=0µÄ¸ù

ͻȻ·¢ÏÖ×Ô¼ºÁ¬Ò»Ôª¶þ´Î·½³ÌÔõôËãµÄ¶¼²»ÖªµÀÁË¡£ÏëÁ˰ëÌ죬ÄÃÆð±ÊÀ´²Å˳ÊÖЩÁ˸øx2+2x+1=0.»ÚºÞ°¡¡£
#include "iostream"
#include "cmath"
using namespace std;
int main(){
double a,b,c;
double delta,x1,x2;
int sign,stop;
cout<<"ÊäÈë3¸öϵÊýa(a!=0),b,c"<<endl;
cin>>a>>b& ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ