C/C++ÊÔÌâ
1¡¢bool¡¢float¡¢Ö¸Õë±äÁ¿Óë"ÁãÖµ"±È½ÏµÄifÓï¾ä£¿
´ð£º
bool flag; if(flag)£¬if(!flag)
char *p; if(p==NULL)£¬if(p!=NULL)
float x;
const float EPSILON = 1e-6;
if((x>=-EPSILON)&&(x<=EPSILON)) //(-0.000001~0.000001)
if((x<-EPSILON)&&(x>EPSILON)) //(+INFINITE~0.000001),(-0.000001~-INFINITE)
2¡¢constÓÐʲôÓÃ;£¿
´ð£º
£¨1£©¿ÉÒÔ¶¨Òåconst ³£Á¿
£¨2£©const ¿ÉÒÔÐÞÊκ¯ÊýµÄ²ÎÊý¡¢·µ»ØÖµ¼°º¯ÊýµÄ¶¨ÒåÌå¡£±»constÐÞÊεĶ«Î÷¶¼Êܵ½Ç¿ÖƱ£»¤£¬¿ÉÒÔÔ¤·ÀÒâÍâµØ±»Ð޸ģ¬ÄÜÌá¸ß³ÌÐòµÄ½¡×³ÐÔ¡£
3¡¢ÔÚC++³ÌÐòÖе÷Óñ»C±àÒëÆ÷±àÒëºóµÄº¯Êý£¬ÎªÊ²Ã´¶¼Òª¼Óextern "C" ?
´ð£º
C++ÓïÑÔÖ§³Öº¯ÊýÖØÔØ£¬CÓïÑÔ²»Ö§³Öº¯ÊýÖØÔØ¡£º¯Êý±»C++±àÒëÆ÷±àÒëºÍ±»C±àÒëÆ÷±àÒëºóÉú³ÉµÄÄÚ²¿Ãû×ÖÊDz»Í¬µÄ¡£¼ÙÉèij¸öº¯ÊýµÄÔÐÍΪ£ºvoid foo(int x,int y);¸Ãº¯Êý±»C±àÒëÆ÷±àÒëºóµÄÄÚ²¿Ãû×ÖΪ_foo£¬ÃæC++±àÒëÆ÷Ôò»á²úÉúÏñ_foo_int_intÖ®ÀàµÄÃû×Ö¡£C++ÌṩÁËCÁ¬½Ó½»»»Ö¸¶¨·ûºÅ extern "C" À´½â¾öÃû×ÖÆ¥ÅäµÄÎÊÌâ¡£
4¡¢ÀàÐÍת»»£º
double d = 100.25;
int x = d;
int *pInt = (int*)&d;
ÇëÎÊÒÔÏÂÁ½¸öÓï¾äÊä³öʲô£¿
cout<< x <<endl;
cout<< *pInt <<endl;
´ð£º
µÚÒ»¸öÊä³ö 100£¬xÈ¡dµÄÕûÊý²¿·Ö¡£
µÚ¶þ¸ö½á¹û²»ÊÇ100£¬*pIntµÈÓÚdµÄÇ°4¸ö×Ö½ÚµÄÊýÖµ£¬¶ø²»ÊÇdµÄÕûÊý²¿·Ö¡£
Ïà¹ØÎĵµ£º
http://blog.csdn.net/Ackarlix/archive/2007/08/25/1758412.aspx
WindowsÏÂCÍøÂç±à³ÌÈëÃÅ
CÓïÑÔµÄѧϰ£¬Ò»°ãµÄ·½Ê½ÊÇ£¬ÏÈѧC£¬È»ºóÊÇC++£¬×îºÃ»¹ÒªÓлã±àÓïÑÔºÍ΢»úÔÀí»ù´¡£¬È»ºó²ÅÊÇVisual C++¡£ÕâÑùµÄ·½Ê½£¬¶ÔѧϰÕßÀ´Ëµ£¬Òª»¨·ÑºÜ¶àʱ¼äºÍÄÍÁ¦¡£¶øÔÚѧУ½ÌѧÖУ¬Ò²Ã»ÓÐʱ¼äÉîÈëѧϰWindows±à³ÌµÄʵÓü¼ÊõÁË¡£
¡¡¡¡ ......
ÐÂÈ˸տªÊ¼Íæ×îºÃ½¨¸öÃâ·ÑºÅÏÈÊìϤÏÂÓÎÏ·£¬ÏÈ°ÑÐÂÊֽ̳Ì×öÍ棬½Ì³ÌÒªÂýÂý×ö£¬°Ñÿһ²½½ÌµÄ¶¼Ñ§µ½¡£ÎÒÇ¿ÁÒBS×öÍê½Ì³Ì»¹²»»áÍê˵½Ì³Ì²»ºÃµÄÈË£¬ÒÔÇ°ÎÒÍêÅ··þ¶¼ÊÇ×öÍê½Ì³Ì¾ÍÄÜ¿ªÊ¼ÍêÁË£¬ÎÒ»¹ÊÇÓõĽðɽ¿ìÒë2002µÄ£¬¸Â¸Â¡£
ÑÔ¹éÕý´«£¬ÐÂÈË×öÍê½Ì³Ì×îºóµÄ2¸öÈÎÎñÊÖÉϸÃÓÐ10W¶àÁË£¨×îºóµÄÄǸö´úÀíÈËÈÎÎñ²»×ö½Ì³ÌÒ²¿ÉÒÔÖ±½Ó×ö£©£¬ ......
ÓÐÈçϳÌÐò£º
//-----------------
class A
{
public:
A()
{
printf( "base A\r\n" );
}
virtual ~A()
{
printf( "base ~A\r\n" );
}
public:
virtual void VirtualFunc()
{
printf( "base VirtualFunc\r\n" );
};
void Func()
{
printf( "base Func\r\n" );
}
void F1()
{
pr ......
±¾ÎÄÊ×·¢µØÖ·£ºhttp://blog.csdn.net/liigo/archive/2009/09/22/4582018.aspx
תÔØÇë×¢Ã÷³ö´¦£ºhttp://blog.csdn.net/liigo
×÷Õߣºliigo, 2009/09/22
¡¡¡¡ÔÚÏÂΧÆåʱ£¬µ±Ò»¸öÆå×ÓÂäµ½ÆåÅÌÉÏ£¬Ëü»á¶ÔÖÜΧ¶Ô·½Æå×ÓµÄËÀ»î²úÉúÓ°Ï죬Èç¹û¶Ô·½Æå×ÓûÓÐÆøÁË£¨ËÀÁË£©£¬±ØÐë´ÓÆåÅÌÉÏÄõô£¨Ìá×Ó£©¡£Õâ¸ö¹ý³ÌÌåÏÖµ½Î§ÆåÈí¼þÖУ¬¾ÍÐ ......
±¾ÎÄÊ×·¢µØÖ·£ºhttp://blog.csdn.net/liigo/archive/2009/09/22/4582018.aspx
תÔØÇë×¢Ã÷³ö´¦£ºhttp://blog.csdn.net/liigo
×÷Õߣºliigo, 2009/09/22
¡¡¡¡ÔÚÏÂΧÆåʱ£¬µ±Ò»¸öÆå×ÓÂäµ½ÆåÅÌÉÏ£¬Ëü»á¶ÔÖÜΧ¶Ô·½Æå×ÓµÄËÀ»î²úÉúÓ°Ï죬Èç¹û¶Ô·½Æå×ÓûÓÐÆøÁË£¨ËÀÁË£©£¬±ØÐë´ÓÆåÅÌÉÏÄõô£¨Ìá×Ó£©¡£Õâ¸ö¹ý³ÌÌåÏÖµ½Î§ÆåÈí¼þÖУ¬¾ÍÐ ......