我总是记不住电话号码。我需要一个记忆规则。


当前回答

这就是我如何记住2147483647的:

214 -因为2.14近似于pi-1 48 = 6*8 64 = 8*8

横向写:

214_48_64_
and insert:
   ^  ^  ^
   7  3  7 - which is Boeing's airliner jet (thanks, sgorozco)

现在你得到了2147483647。

希望这能有所帮助。

其他回答

你会发现在二进制中Int32的最大值是11111111111111111111111111111111111111111 但以10为基数,你会发现它是2147483647或2^31-1或Int32。MaxValue

试试用Python:

>>> int('1' * 31, base=2)
2147483647

如果你能记住圆周率的整个数字,那么你要找的数字在圆周率的十进制数字1867996680到1867996689的位置

数字字符串2147483647出现在圆周率的十进制数字1,867,996,680。3.14......86181221809936452346214748364710527835665425671614…

来源:http://www.subidiom.com/pi/

它有32位,因此可以存储2^32个不同的值。其中一半是负面的。

答案是2147,483,647

最低的是- 2,147,483,648。

(注意这里多了一个负数。)

最简单的方法是查看std::numeric_limits< int >::max()

例如(来自MSDN),

// numeric_limits_max.cpp

#include <iostream>
#include <limits>

using namespace std;

int main() {
   cout << "The maximum value for type float is:  "
        << numeric_limits<float>::max( )
        << endl;
   cout << "The maximum value for type double is:  "
        << numeric_limits<double>::max( )
        << endl;
   cout << "The maximum value for type int is:  "
        << numeric_limits<int>::max( )
        << endl;
   cout << "The maximum value for type short int is:  "
        << numeric_limits<short int>::max( )
        << endl;
}