• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            Impossible is nothing  
              愛過知情重醉過知酒濃   花開花謝終是空   緣份不停留像春風(fēng)來又走   女人如花花似夢
            公告
            日歷
            <2025年6月>
            25262728293031
            1234567
            891011121314
            15161718192021
            22232425262728
            293012345
            統(tǒng)計(jì)
            • 隨筆 - 8
            • 文章 - 91
            • 評(píng)論 - 16
            • 引用 - 0

            導(dǎo)航

            常用鏈接

            留言簿(4)

            隨筆分類(4)

            隨筆檔案(8)

            文章分類(77)

            文章檔案(91)

            相冊

            搜索

            •  

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

             

            1. c++中類的相互引用
             
              原則是:相互引用的class要分別寫.h和.cpp文件(分別合用一個(gè).h,.cpp也可)
                     在.h文件中只需申明class類型即可,一定不要包含其他類的頭文件
                     在.cpp文件中必須要包含其他要引用的頭件
                     不要將函數(shù)申明跟寒暑提在同一文件中實(shí)現(xiàn),否則會(huì)出意想不到的錯(cuò)誤?。。?BR>        
                     a.h b.h 合成一個(gè).h文件
                     a.cpp b.cpp 合成一個(gè).cpp文件也可
                    
              a.h 
              #ifndef _A_
              #define _A_
              
              class b;
              class a;
              
              class a {
               friend class  b;
              private:
               int aa;  
               void a1( b m );
              };
              #endif
               a.cpp
                    #include "stdafx.h"
              #include "a.h"
              #include "b.h"
              
              void a::a1(b m )
              { 
               m.bb = 0 ;
              }
               b.h
              #ifndef _B_
              #define _B_
              class  b;
              class a;
              
              class  b
              {
               friend class a;
              private:
               int bb;
               void zzz(a n);
              }; 
              #endif
             b.cpp
                 #include "stdafx.h"
              #include "b.h"
              #include "a.h"
              void b::zzz(a m )
              { 
               m.aa = 0 ;
              } 
             
               main.cpp
              #include "stdafx.h"
              #include "a.h"
              #include "b.h"
              
              int main(int argc, char* argv[])
              {
              
                  a aa;
                  b bb;
              
                  return 0;
              }

            2. 鏈表的好用法
               struct a {
                 static a *mLinkedList; // 申明為一個(gè)靜態(tài)變量
             
                 a *mNext;
                 bool mCanRemoteCreate;

                a(bool canRemoteCreate)
                {
                   mNext = mLinkedList;
                   mLinkedList = this;
                   mCanRemoteCreate = canRemoteCreate;
                }
                static int *create(const char *name);
              };
             
              a *a::mLinkedList = NULL; // 初始化
             
            3. 靈活的應(yīng)用# ##
            Token-Pasting Operator (##)

            #define paster( n ) printf( "token" #n " = %d", token##n )
            int token9 = 9;
            If a macro is called with a numeric argument like
            paster( 9 );the macro yields
            printf( "token" "9" " = %d", token9 );which becomes
            printf( "token9 = %d", token9 );

            Stringizing Operator (#)
            #define stringer( x ) printf( #x "\n" )
            void main()
            {
                stringer( In quotes in the printf function call\n );
                stringer( "In quotes when printed to the screen"\n );  
                stringer( "This: \"  prints an escaped double quote" );
            }
            Such invocations would be expanded during preprocessing, producing the following code:
            void main()
            {
               printf( "In quotes in the printf function call\n" "\n" );
               printf( "\"In quotes when printed to the screen\"\n" "\n" );
               printf( "\"This:
            \\\" prints an escaped double quote\"" "\n" );
            }
            When the program is run, screen output for each line is as follows:In quotes in the printf function call
            "In quotes when printed to the screen"
            "This: \" prints an escaped double quotation mark"
            #define IMPLEMENT_NETCONNECTION(className, classGroup, canRemoteCreate) \
               NetClassRep* className::getClassRep() const { return &className::dynClassRep; } \
               NetClassRepInstance<className> className::dynClassRep(#className, 0, NetClassTypeNone, 0); \
               NetClassGroup className::getNetClassGroup() const { return classGroup; } \
               static NetConnectionRep g##className##Rep(&className::dynClassRep, canRemoteCreate)

            4. 枚舉:初始化為0值開始,后者比前者大1,除非顯式指定.
               By default, the first enumerator has a value of 0, and each successive enumerator is one larger
               than the value of the previous one, unless you explicitly specify a value for a particular
               enumerator. Enumerators needn’t have unique values. The name of each enumerator is treated
               as a constant and must be unique within the scope where the enum is defined. An enumerator
               can be promoted to an integer value. However, converting an integer to an enumerator requires
               an explicit cast, and the results are not defined.

            =========================
            一些優(yōu)秀的數(shù)學(xué)算法
            5.1 /// Determines if number is a power of two.
             inline bool isPow2(const U32 number)
             {
                return (number & (number - 1)) == 0;
             }
            5.2 浮點(diǎn)數(shù)的計(jì)算機(jī)中的儲(chǔ)存方法

                單精度      1|   8   |   23    |
                         符號(hào)  指數(shù)      尾數(shù)
                雙精度      1|   11  |   52    |
                         符號(hào)  指數(shù)      尾數(shù)  
                        
                10110.100011 -> 1.0110100011* 2(4) 2的4之方
               
                符號(hào)位 0
                尾數(shù)   0110100011
                指數(shù)   4 以過剩127儲(chǔ)存 +127= 131  -> 10000011
                所以  IEEE 754 : 0100000110110100011
               
                -0.0010011  -> -1.0011 * 2(-3) 2的-3之方
                符號(hào)位:-1
                尾數(shù)  : 0011
                指數(shù)為:-3  +127  的124 -〉01111100
                所以: 1 01111100 0011000000000000000000
               
                /// Determines the binary logarithm of the input value rounded down to the nearest power of 2.
             inline U32 getBinLog2(U32 value)
             {
                F32 floatValue = F32(value);
                return (*((U32 *) &floatValue) >> 23) - 127;
             }

            posted on 2006-03-03 15:30 笑笑生 閱讀(266) 評(píng)論(0)  編輯 收藏 引用 所屬分類: C++語言
             
            Copyright © 笑笑生 Powered by: 博客園 模板提供:滬江博客
            东方aⅴ免费观看久久av | 精品久久久久久久中文字幕| 久久精品国产亚洲av水果派| 久久精品男人影院| 理论片午午伦夜理片久久| 亚洲国产精品成人久久| 久久精品视频网| 国产成人精品综合久久久| 久久亚洲国产中v天仙www| 亚洲&#228;v永久无码精品天堂久久 | 国产精品久久影院| 国产亚州精品女人久久久久久 | 国产成人精品久久一区二区三区av| 久久久久亚洲AV无码专区网站 | 久久精品国产影库免费看| 久久久久久久久久免免费精品| 亚洲国产精品无码久久98| 大美女久久久久久j久久| 久久精品国产99久久无毒不卡| 久久精品亚洲福利| 久久久久国产精品| 色婷婷综合久久久久中文一区二区| 久久成人永久免费播放| 国产精品禁18久久久夂久| 东方aⅴ免费观看久久av| 久久人妻少妇嫩草AV蜜桃| 热re99久久精品国产99热| 久久超碰97人人做人人爱| 亚洲色欲久久久久综合网| 久久久久18| 青青青青久久精品国产h久久精品五福影院1421 | 婷婷久久综合九色综合98| 狠狠色噜噜色狠狠狠综合久久| 久久九九久精品国产| 久久免费视频观看| 99久久免费只有精品国产| 国产成人综合久久综合| 国产精品一久久香蕉国产线看 | 久久精品国产亚洲7777| 日韩人妻无码一区二区三区久久99| 国产精品欧美久久久天天影视|