Home >Backend Development >C#.Net Tutorial >How to get the extreme value of a numerical value in C++

How to get the extreme value of a numerical value in C++

零到壹度
零到壹度Original
2018-04-04 16:13:172577browse

This article mainly introduces how to obtain numerical extreme values ​​in C++. The editor thinks it is quite good. Now I will share it with you and give it as a reference. Let’s follow the editor and take a look

include <iostream>
#include <limits>
using namespace std;

#define L_VALUE(a) (cout<<(#a)<<" is "<<(a)<<endl)
#define L_ADDR(a) printf("%p\n", a)

int main()
{
  L_VALUE(numeric_limits<short>::max());
  L_VALUE(numeric_limits<int>::max());
  L_VALUE(numeric_limits<long>::max());
  L_VALUE(numeric_limits<float>::max());
  L_VALUE(numeric_limits<double>::max());
  
  getchar();
  getchar();
  return 0;
}

Related recommendations:

C++ A quick method to convert an unterminated string (ASCII) to a numeric value (supports hexadecimal)

Numerical analysis: data interpolation method

The above is the detailed content of How to get the extreme value of a numerical value in C++. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn