• <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 煙皚 閱讀(705) 評論(0)  編輯 收藏 引用 所屬分類: C++ primer plus學習筆記
            久久人人爽人人爽人人片AV东京热| 国产精品久久久香蕉| 狠狠色丁香久久婷婷综合_中 | 国产精品日韩深夜福利久久| 国产精品久久久久久久| 久久精品午夜一区二区福利| 日韩精品久久无码人妻中文字幕| 亚洲色婷婷综合久久| 久久亚洲AV成人无码国产| 国产精品免费福利久久| 日韩一区二区久久久久久| 国产精品热久久无码av| 欧美与黑人午夜性猛交久久久| 久久午夜综合久久| 99久久国产精品免费一区二区| 无码AV波多野结衣久久| 精品久久久久久中文字幕| 久久九九免费高清视频| 合区精品久久久中文字幕一区| 久久久无码精品亚洲日韩蜜臀浪潮| 亚洲午夜久久久久妓女影院| 99麻豆久久久国产精品免费 | 久久久久国产| 中文字幕日本人妻久久久免费| 久久久久亚洲av无码专区导航| 久久最近最新中文字幕大全| 三级韩国一区久久二区综合| 日产精品久久久久久久性色| 大美女久久久久久j久久| 欧美精品国产综合久久| 狠狠色噜噜狠狠狠狠狠色综合久久| 欧美日韩中文字幕久久久不卡 | 久久精品国产清高在天天线| 精品久久综合1区2区3区激情| 欧美伊人久久大香线蕉综合 | 久久婷婷激情综合色综合俺也去| 久久中文娱乐网| 色欲av伊人久久大香线蕉影院| 九九热久久免费视频| 少妇久久久久久久久久| 亚洲国产精品综合久久一线 |