65,211
社区成员
发帖
与我相关
我的任务
分享using namespace std;#include <limits>
#include <iostream>
#include <stdio.h>
using std::cout;
using std::endl;
using std::numeric_limits;
int main(int argc, char* argv[])
{
cout <<endl
<<"The range for type short is from"
<<numeric_limits <short>::min()
<<"to"
<<numeric_limits <short>::max();
cout <<endl
<<"The range for type int is from"
<<numeric_limits <int>::min()
<<"to"
<<numeric_limits <int>::max();
cout <<endl
<<"The range for type long is from"
<<numeric_limits <long>::min()
<<"to"
<<numeric_limits <long>::max();
cout <<endl
<<"The range for type float is from"
<<numeric_limits <float>::min()
<<"to"
<<numeric_limits <float>::max();
cout <<endl
<<"The range for type double is from"
<<numeric_limits <double>::min()
<<"to"
<<numeric_limits <double>::max();
cout <<endl
<<"The range for type long double is from"
<<"to"
<<numeric_limits <long double>::max();
cout <<endl;
getchar();
return 0;
}
//编译没问题
//运行结果
The range for type short is from-32768to32767
The range for type int is from-2147483648to2147483647
The range for type long is from-2147483648to2147483647
The range for type float is from1.17549e-038to3.40282e+038
The range for type double is from2.22507e-308to1.79769e+308
The range for type long double is fromto1.79769e+308