numeric_limits::max ()的用法

numeric_limits<double>::max ()
是函数,返回编译器允许的 double 型数 最大值。
类似的 numeric_limits<int>::max () 返回 编译器允许的 int 型数 最大值。
需包含头文件 #include <limits>

例子:
#include <iostream>
#include <limits>
using namespace std;
main()

{
cout << std::numeric_limits<double>::max () << endl;
cout << std::numeric_limits<int>::max () << endl;
}

发布了10 篇原创文章 · 获赞 0 · 访问量 231

猜你喜欢

转载自blog.csdn.net/qq_37554547/article/details/96852197