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

零到壹度
Release: 2018-04-04 16:13:17
Original
2552 people have browsed it

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;
}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template