limits打印

#include<iostream>
#include<climits>
#include<map>
using namespace std;
int main() {
  typedef string          t_s;
  typedef long long int   t_i;
  typedef map<t_s, t_i>   m_s_i;

  m_s_i::iterator it;
  m_s_i tlm = { // type_length_map
    { "CHAR_BIT",   CHAR_BIT  }, // 2^3
    { "CHAR_MIN",   CHAR_MIN  }, // -2^7
    { "CHAR_MAX",   CHAR_MAX  }, // 2^7-1
    { "INT_MIN",    INT_MIN   }, // -2^31
    { "INT_MAX",    INT_MAX   }, // 2^31 - 1
    { "LONG_MIN",   LONG_MIN  }, // -2^63
    { "LONG_MAX",   LONG_MAX  }, // 2^63 - 1
    { "SHRT_MIN",   SHRT_MIN  }, // -2^15
    { "SHRT_MAX",   SHRT_MAX  }, // 2^15 - 1
    { "UCHAR_MAX",  UCHAR_MAX }, // 2^8 - 1
    { "ULONG_MAX",  ULONG_MAX }, // 2^64 - 1
    { "UINT_MAX",   UINT_MAX  }, // 2^32 - 1
    { "USHRT_MAX",  USHRT_MAX }, // 2^16 - 1
  };

  for (it = tlm.begin(); it != tlm.end(); it++) {
    cout.width(10);
    cout << it->first << " : " << it->second << endl;
  }
  return 0;
}
原文地址:https://www.cnblogs.com/hencins/p/14664176.html