C++/CÊÔÌâ
C++/CÊÔÌâµÄ´ð°¸ÓëÆÀ·Ö±ê×¼(À´×ÔÓÚÁÖÈñµÄ<<¸ßÖÊÁ¿C++±à³ÌÖ¸ÄÏ>>),È«ÎÄÇëµ½±¾²©×ÊÔ´ÖÐÏÂÔØ.
Ò»¡¢ÇëÌîдBOOL , float, Ö¸Õë±äÁ¿ Óë“ÁãÖµ”±È½ÏµÄ if Óï¾ä¡££¨10·Ö£©
Çëд³ö BOOL flag Óë“ÁãÖµ”±È½ÏµÄ if Óï¾ä¡££¨3·Ö£©
±ê×¼´ð°¸£º
if ( flag )
if ( !flag )
ÈçÏÂд·¨¾ùÊô²»Á¼·ç¸ñ£¬²»µÃ·Ö¡£
if (flag == TRUE)
if (flag == 1 )
if (flag == FALSE)
if (flag == 0)
Çëд³ö float x Óë“ÁãÖµ”±È½ÏµÄ if Óï¾ä¡££¨4·Ö£©
±ê×¼´ð°¸Ê¾Àý£º
const float EPSINON = 0.00001;
if ((x >= - EPSINON) && (x <= EPSINON)
²»¿É½«¸¡µã±äÁ¿ÓÓ==”»ò“£¡=”ÓëÊý×ֱȽϣ¬Ó¦¸ÃÉ跨ת»¯³É“>=”»ò“<=”´ËÀàÐÎʽ¡£
ÈçÏÂÊÇ´íÎóµÄд·¨£¬²»µÃ·Ö¡£
if (x == 0.0)
if (x != 0.0)
Çëд³ö char *p Óë“ÁãÖµ”±È½ÏµÄ if Óï¾ä¡££¨3·Ö£©
±ê×¼´ð°¸£º
if (p == NULL)
if (p != NULL)
ÈçÏÂд·¨¾ùÊô²»Á¼·ç¸ñ£¬²»µÃ·Ö¡£
if (p == 0)
if (p != 0)
if (p)
if (!)
¶þ¡¢ÒÔÏÂΪWindows NTϵÄ32λC++³ÌÐò£¬Çë¼ÆËãsizeofµÄÖµ£¨10·Ö£©
char str[] = “Hello” ;
char *p = str ;
int n = 10;
Çë¼ÆËã
sizeof (str ) = 6 £¨2·Ö£©
sizeof ( p ) = 4 £¨2·Ö£©
sizeof ( n ) = 4 £¨2·Ö£©
void Func ( char str[100])
{
Ïà¹ØÎĵµ£º
CRT (C run-time library)
Ò» ²úÉú
ÔËÐÐʱ¿âÊdzÌÐòÔÚÔËÐÐʱËùÐèÒªµÄ¿âÎļþ£¬Í¨³£ÒÔLIB»òDLLÐÎʽÌṩ¡£
CÔËÐÐʱ¿â¾ÍÊÇC run-time library£¬µ®ÉúÓÚ20ÊÀ¼Í70Äê´ú£¬ÊÇC¶ø·ÇC++ÓïÑÔÊÀ½çµÄ¸ÅÄC³ÌÐòÔËÐÐʱÐèÒªÕâЩ¿âÖеĺ¯Êý¡£
C ÓïÑÔÊÇËùνµÄ“СÄں˔ÓïÑÔ£¬¾ÍÆäÓïÑÔ±¾ÉíÀ´ËµºÜС£¨²»¶àµÄ¹Ø¼ü×Ö£¬³ÌÐòÁ÷³Ì¿ØÖÆ£ ......
C++Á¬½ÓOracle
ÔÚVisual C++Ï¿ª·¢Oracle¿â½Ó¿ÚÖ÷ÒªÓÐÁ½ÖÖ·½·¨¡£Ò»ÖÖ·½·¨ÊÇÀûÓÃVisual C++ÌṩµÄ¶àÖÖÊý¾Ý¿â·ÃÎʼ¼Êõ£¬È翪·ÅÊý¾Ý¿âÁ¬½ÓODBC¡¢Êý¾Ý´æÈ¡¶ÔÏóDAO¡¢¶ÔÏóÁ¬½ÓºÍǶÈëÊý¾Ý¿âOLE DBºÍActiveXÊý¾Ý¶ÔÏóADOµÈ¡£ÁíÒ»ÖÖ·½·¨ÊÇÔÚVisual C++ÖÐǶÈëSQLÓï¾ä£¬Õâ¾ÍÊÇËùÖ ......
1.ÇóÏÂÃ溯ÊýµÄ·µ»ØÖµ£¨Î¢Èí£©
int func(x)
{
int countx = 0;
while(x)
{
countx ++;
x = x&(x-1);
}
return countx;
}
¼Ù¶¨x = 9999¡£ ´ð°¸£º8
˼·£º½«xת»¯Îª2½øÖÆ£¬¿´º¬ÓеÄ1µÄ¸öÊý¡£
2. ʲôÊÇ“ÒýÓÔ£¿ÉêÃ÷ºÍʹÓÓÒýÓÔҪעÒâÄÄЩÎÊÌ⣿
´ð£ºÒýÓþÍÊÇij¸öÄ¿±ê±äÁ¿µÄ&ldquo ......
/***************************************************
* º¯Êý˵Ã÷: Åжϵ±Ç°path²ÎÊýÊÇ·ñΪһ¸ö¿É¶ÁµÄÎļþ
* º¯Êý·µ»Ø: 0 - Îļþ¿Ì¶È 1 - ȨÏ޾ܾø -1 -º¯Êý´íÎó
* ²Î Êý : path Îļþ·¾¶.
***************************************************/
int isReadFile(const char *path)
{
&nb ......
Ôø¾Åöµ½¹ýÈÃÄãÃԻ󲻽⡢ÀàËÆÓÚint * (* (*fp1) (int) )
[10];ÕâÑùµÄ±äÁ¿ÉùÃ÷Â𣿱¾ÎĽ«ÓÉÒ×µ½ÄÑ£¬Ò»²½Ò»²½½Ì»áÄãÈçºÎÀí½âÕâÖÖ¸´ÔÓµÄC/C++ÉùÃ÷£ºÎÒÃÇ
½«´ÓÿÌ춼ÄÜÅöµ½µÄ½Ï¼òµ¥µÄÉùÃ÷ÈëÊÖ£¬È»ºóÖð²½¼ÓÈëconstÐÞÊÎ
·ûºÍtypedef£¬»¹Óк¯ÊýÖ¸Õ룬×îºó½éÉÜÒ»¸öÄܹ»ÈÃÄã׼ȷµØÀí½âÈκÎC/C++ ......