• <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>

              C++博客 :: 首頁 :: 聯系 :: 聚合  :: 管理
              117 Posts :: 2 Stories :: 61 Comments :: 0 Trackbacks

            常用鏈接

            留言簿(8)

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

                  首先,sizeof操作符返回類型或變量的長度,單位是字節。注意,“字節”依賴于實現,因此在一個系統中,兩字節的int可能是16位,而在另一個系統中可能是32位。
                  其次,頭文件climits(在老式實現中為limits.h)中包含了關于整型限制的信息。具體地說,它定義了表示各種限制的符號名稱。例如,INT_MAX為int的最大取值,CHAR_BIT為字節的位數。
                  
                  實現代碼如下:

            #include "stdafx.h"
            #include 
            <climits>    //use limits.h for older systems
            #include <iostream>
            int main(int argc, char* argv[])
            {
                
            using namespace std;
                
            int n_int = INT_MAX;    //initialize n_int to max int value
                short n_short = SHRT_MAX; //symbols defined in limits.h file
                long n_long = LONG_MAX;

                
            //sizeof operator yields size of type or of variable
                cout<<"int is "<<sizeof(int)<<" bytes."<<endl;
                cout
            <<"short is "<<sizeof(n_short)<<" bytes"<<endl;
                cout
            <<"long is "<<sizeof(n_long)<<" bytes."<<endl<<endl;

                cout
            <<"Maximum values:"<<endl;
                cout
            <<"int: "<<n_int<<endl;
                cout
            <<"short: "<<n_short<<endl;
                cout
            <<"long: "<<n_long<<endl;

                cout
            <<"Minimum int values = "<<INT_MIN<<endl;
                cout
            <<"Bits per byte = "<<CHAR_BIT<<endl;
                
            return 0;
            }

            結果如下:
            posted on 2010-02-05 14:03 煙皚 閱讀(717) 評論(0)  編輯 收藏 引用 所屬分類: C++ primer plus學習筆記
            久久精品国产亚洲av高清漫画 | 国产香蕉久久精品综合网| 久久国产美女免费观看精品| 欧美麻豆久久久久久中文| 国产偷久久久精品专区| 精品一区二区久久久久久久网站| 久久国产成人| 久久精品亚洲精品国产色婷| 国产精品成人无码久久久久久| 中文字幕热久久久久久久| 观看 国产综合久久久久鬼色 欧美 亚洲 一区二区 | 97久久香蕉国产线看观看| 四虎亚洲国产成人久久精品| 精品久久久久久中文字幕人妻最新| 久久久久久国产精品无码下载 | 久久久久亚洲AV成人网人人网站| 国产精品久久99| 亚洲AV乱码久久精品蜜桃| 久久国产精品免费一区| 韩国三级大全久久网站| 亚洲精品乱码久久久久久久久久久久| 国产成人久久精品麻豆一区| 国产高潮国产高潮久久久| 精品伊人久久大线蕉色首页| 久久久久无码国产精品不卡| 99久久综合国产精品二区| 久久精品国产91久久麻豆自制 | 日韩精品久久无码人妻中文字幕| 色偷偷88欧美精品久久久 | 久久国产乱子伦精品免费强| 午夜不卡久久精品无码免费| 亚洲国产精品一区二区久久hs| 国产精品久久久久久久久久影院 | 久久久久亚洲AV无码专区桃色| 亚洲国产精品热久久| 日本精品久久久久中文字幕8| AV无码久久久久不卡蜜桃| 国产精品久久久久影视不卡| 99久久精品费精品国产| 久久99精品久久久久久齐齐| 亚洲国产成人久久一区WWW|