常用整型变量的最大取值范围

#include<iostream>
#include<math.h>
#include<limits.h>
using namespace std;

int main()
{
    // 2^16 = 32768 : unsigned short
    // 2^32 = 4.29497e+009 : unsigned int, long
    // 2^64 = 1.84467e+019 : unsigned long long
    // SHRT_MAX = 32767 (3.2e+004): short
    // INT_MAX = 2147483647 (2.1e+009) : int 
    // LONG_MAX = 2147483647 (2.1e+009) : long
    // LONG_LONG_MAX = 9.2e+018 : long long
    
    cout << pow(2,31) << endl;
    cout << SHRT_MAX << endl;
    cout << INT_MAX << endl;
    cout << LONG_MAX << endl;
     
    return 0;
    
} 

 

posted @ 2018-10-03 10:57  juxq  阅读(1603)  评论(0)    收藏  举报