首页 > 其他 > 详细

limits打印

时间:2021-04-15 23:50:27      阅读:26      评论:0      收藏:0      [点我收藏+]
#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;
}

limits打印

原文:https://www.cnblogs.com/hencins/p/14664176.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!