#include <iostream>
#include <float.h>
using namespace std
;
int main()
{
cout
<< "int 类型能存储的最大值和最小值" << endl
;
cout
<< "INT_MAX = " << INT_MAX
<< endl
;
cout
<< "INT_MIN = " << INT_MIN
<< endl
;
cout
<< "long 类型能存储的最大值和最小值" << endl
;
cout
<< "LONG_MAX = " << LONG_MAX
<< endl
;
cout
<< "LONG_MIN = " << LONG_MIN
<< endl
;
cout
<< "long long 类型能存储的最大值和最小值" << endl
;
cout
<< "LONG_LONG_MAX = " << LONG_LONG_MAX
<< endl
;
cout
<< "LONG_LONG_MIN = " << LONG_LONG_MIN
<< endl
;
cout
<< "float 类型能存储的最大值和最小值" << endl
;
cout
<< "FLT_MAX = " << FLT_MAX
<< endl
;
cout
<< "FLT_MIN = " << FLT_MIN
<< endl
;
cout
<< "double 类型能存储的最大值和最小值" << endl
;
cout
<< "DBL_MAX = " << DBL_MAX
<< endl
;
cout
<< "DBL_MIN = " << DBL_MIN
<< endl
;
return 0;
}
-----------结果如下
---------------
int 类型能存储的最大值和最小值
INT_MAX
= 2147483647
INT_MIN
= -2147483648
long 类型能存储的最大值和最小值
LONG_MAX
= 9223372036854775807
LONG_MIN
= -9223372036854775808
long long 类型能存储的最大值和最小值
LONG_LONG_MAX
= 9223372036854775807
LONG_LONG_MIN
= -9223372036854775808
float 类型能存储的最大值和最小值
FLT_MAX
= 3.40282e+38
FLT_MIN
= 1.17549e-38
double 类型能存储的最大值和最小值
DBL_MAX
= 1.79769e+308
DBL_MIN
= 2.22507e-308
转载请注明原文地址:https://tech.qufami.com/read-8287.html