• <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 煙皚 閱讀(709) 評論(0)  編輯 收藏 引用 所屬分類: C++ primer plus學習筆記
            久久99国产亚洲高清观看首页 | 日本免费一区二区久久人人澡| 久久久久se色偷偷亚洲精品av| 亚洲欧美国产精品专区久久| av色综合久久天堂av色综合在| 性欧美丰满熟妇XXXX性久久久 | 人妻丰满AV无码久久不卡| 久久久久亚洲AV无码专区体验 | 亚洲国产成人久久综合碰| 久久久久久久女国产乱让韩| 久久av无码专区亚洲av桃花岛| 色综合久久久久| 久久久久se色偷偷亚洲精品av| 久久综合丁香激情久久| 久久综合亚洲色一区二区三区| 国产91色综合久久免费| 一本久久免费视频| 亚洲国产精久久久久久久| 久久成人小视频| 久久精品成人免费国产片小草 | 久久精品国产精品亜洲毛片| 久久久久人妻一区精品色| 久久久久九九精品影院| 国产午夜精品久久久久免费视 | 国产成人精品白浆久久69| 亚洲国产成人久久一区WWW| 久久777国产线看观看精品| 亚洲综合熟女久久久30p| 亚洲精品美女久久久久99小说| 草草久久久无码国产专区| 97久久久精品综合88久久| 色欲综合久久躁天天躁蜜桃| 亚洲午夜精品久久久久久app| 99久久精品国产一区二区三区 | 久久精品国产精品亚洲人人| 四虎国产永久免费久久| 91精品国产综合久久精品| 久久国产精品99国产精| 久久精品黄AA片一区二区三区| 国产精品久久久久久五月尺| 漂亮人妻被中出中文字幕久久|