具体用法参考C++官网

/ /numeric_limits example
#include <iostream>
#include <limits>
using namespace std;

int main () {
  cout << boolalpha;
  cout << "Minimum value for int: " << numeric_limits<int>::min() << endl;
  cout << "Maximum value for int: " << numeric_limits<int>::max() << endl;
  cout << "int is signed: " << numeric_limits<int>::is_signed << endl;
  cout << "Non-sign bits in int: " << numeric_limits<int>::digits << endl;
  cout << "int has infinity: " << numeric_limits<int>::has_infinity << endl;
  return 0;
}


/*
 * Author: visayafan
 * Email:  visayafan[AT]gmail.com
 */

#include <iostream>
#include <limits>
using namespace std;
int main(int argc, char *argv[])
{
     int min =numeric_limits<int>::min();
     double dmin = numeric_limits<double>::min();
     cout<<min<<endl;
     cout<<dmin<<endl;
     return 0;
}

相关文章:

  • 2021-08-06
  • 2021-08-27
  • 2021-12-13
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-01
  • 2021-10-10
  • 2022-02-16
  • 2022-12-23
  • 2021-11-02
相关资源
相似解决方案