Wyznaczanie wartości min i max dla poszczególnych typów zmiennych.

  1. #include<iostream>
  2. #include <limits>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.    cout << "\nMinimum value for int: " << numeric_limits<int>::min();
  8.    cout << "\nMaximum value for int: " << numeric_limits<int>::max();
  9.    cout << "\nMaximum value for long: " << numeric_limits<long>::max();
  10.    cout << "\nMaximum value for long long: " << numeric_limits<long long>::max();
  11.    cout << "\nMinimum value for float: " << numeric_limits<float>::min();
  12.    cout << "\nMaximum value for float: " << numeric_limits<float>::max();
  13.    cout << "\nMinimum value for double: " << numeric_limits<double>::min();
  14.    cout << "\nMaximum value for double: " << numeric_limits<double>::max();
  15.    return 0;
  16. }