符号属性     长度属性     基本型     所占位数     取值范围       输入符举例      输出符举例

--            --          char         8         -2^7 ~ 2^7-1        %c          %c、%d、%u
signed        --          char         8         -2^7 ~ 2^7-1        %c          %c、%d、%u
unsigned      --          char         8         0 ~ 2^8-1           %c          %c、%d、%u

[signed]      short       [int]        16        -2^15 ~ 2^15-1              %hd
unsigned      short       [int]        16        0 ~ 2^16-1             %hu、%ho、%hx

[signed]      --           int         32        -2^31 ~ 2^31-1              %d
unsigned      --          [int]        32        0 ~ 2^32-1              %u、%o、%x

[signed]      long        [int]        32        -2^31 ~ 2^31-1              %ld
unsigned      long        [int]        32        0 ~ 2^32-1             %lu、%lo、%lx

[signed]      long long   [int]        64        -2^63 ~ 2^63-1             %I64d
unsigned      long long   [int]        64        0 ~ 2^64-1          %I64u、%I64o、%I64x

--            --          float        32       +/- 3.40282e+038         %f、%e、%g
--            --          double       64       +/- 1.79769e+308 %lf、%le、%lg   %f、%e、%g
--            long        double       96       +/- 1.79769e+308        %Lf、%Le、%Lg

#include<iostream>
#include <limits>
using namespace std; int main()
{
//bool
cout << "bool: \t\t" << "所占字节数:" << sizeof(bool);
cout << "\t最大值:" << (numeric_limits<bool>::max)();
cout << "\t\t最小值:" << (numeric_limits<bool>::min)() << endl;
//char
cout << "char: \t\t" << "所占字节数:" << sizeof(char);
cout << "\t最大值:" << (numeric_limits<char>::max)();
cout << "\t\t最小值:" << (numeric_limits<char>::min)() << endl;
//signed char
cout << "signed char: \t" << "所占字节数:" << sizeof(signed char);
cout << "\t最大值:" << (numeric_limits<signed char>::max)();
cout << "\t\t最小值:" << (numeric_limits<signed char>::min)() << endl;
//unsigned char
cout << "unsigned char: \t" << "所占字节数:" << sizeof(unsigned char);
cout << "\t最大值:" << (numeric_limits<unsigned char>::max)();
cout << "\t\t最小值:" << (numeric_limits<unsigned char>::min)() << endl;
//wchar_t
cout << "wchar_t: \t" << "所占字节数:" << sizeof(wchar_t);
cout << "\t最大值:" << (numeric_limits<wchar_t>::max)();
cout << "\t\t最小值:" << (numeric_limits<wchar_t>::min)() << endl;
//short
cout << "short: \t\t" << "所占字节数:" << sizeof(short);
cout << "\t最大值:" << (numeric_limits<short>::max)();
cout << "\t\t最小值:" << (numeric_limits<short>::min)() << endl;
//int
cout << "int: \t\t" << "所占字节数:" << sizeof(int);
cout << "\t最大值:" << (numeric_limits<int>::max)();
cout << "\t最小值:" << (numeric_limits<int>::min)() << endl;
//unsigned
cout << "unsigned: \t" << "所占字节数:" << sizeof(unsigned);
cout << "\t最大值:" << (numeric_limits<unsigned>::max)();
cout << "\t最小值:" << (numeric_limits<unsigned>::min)() << endl;
//long
cout << "long: \t\t" << "所占字节数:" << sizeof(long);
cout << "\t最大值:" << (numeric_limits<long>::max)();
cout << "\t最小值:" << (numeric_limits<long>::min)() << endl;
//unsigned long
cout << "unsigned long: \t" << "所占字节数:" << sizeof(unsigned long);
cout << "\t最大值:" << (numeric_limits<unsigned long>::max)();
cout << "\t最小值:" << (numeric_limits<unsigned long>::min)() << endl;
//float
cout << "float: \t\t" << "所占字节数:" << sizeof(float);
cout << "\t最大值:" << (numeric_limits<float>::max)();
cout << "\t最小值:" << (numeric_limits<float>::min)() << endl;
//size_t
cout << "size_t: \t" << "所占字节数:" << sizeof(size_t);
cout << "\t最大值:" << (numeric_limits<size_t>::max)();
cout << "\t最小值:" << (numeric_limits<size_t>::min)() << endl;
//double
cout << "double: \t" << "所占字节数:" << sizeof(double);
cout << "\t最大值:" << (numeric_limits<double>::max)();
cout << "\t最小值:" << (numeric_limits<double>::min)() << endl;
//long long
cout << "long long: \t" << "所占字节数:" << sizeof(long long);
cout << "\t最大值:" << (numeric_limits<long long>::max)();
cout << "\t最小值:" << (numeric_limits<long long>::min)() << endl;
//long double
cout << "long double: \t" << "所占字节数:" << sizeof(long double);
cout << "\t最大值:" << (numeric_limits<long double>::max)();
cout << "\t最小值:" << (numeric_limits<long double>::min)() << endl;
return 0;
}

最新文章

  1. Dubbo
  2. Nim教程【十二】
  3. HBase中的压缩算法比较 GZIP、LZO、Zippy、Snappy [转]
  4. codeforces 558B. Amr and The Large Array 解题报告
  5. C语言-02-基本运算
  6. Chrysler -- CCD (Chrysler Collision Detection) Data Bus
  7. JAVA命名、注释规范
  8. android——屏幕适配大全(转载)
  9. 转:selenium 并行启动多个浏览器
  10. java模拟斗地主发牌看牌
  11. 最佳时间买入卖出股票 Best Time to Buy and Sell Stock LeetCode
  12. 解决不同操作系统下git换行符一致性问题
  13. python+selenium运行时,提示元素不可见
  14. 正则表达示 for Python3
  15. MVP模式和Clean模式
  16. fiddler学习总结--手机端(APP/微信小程序)抓包
  17. 解决TypeError: __init__() missing 1 required positional argument: &#39;on_delete&#39;
  18. wrapper class (Integer 为例)
  19. Submline Text 3插件sublimeTmpl添加新模板
  20. flask中的蓝图实现模块化的应用

热门文章

  1. XHTML文档基本结构
  2. hdu 3111 DLX解数独
  3. Unity之定时调用
  4. CSS标签知识
  5. Git之基本命令
  6. javascript将浮点数转换成整数的三个方法
  7. 命令行启动tomcat,怎么配置
  8. 3月3日 Mark
  9. ArcGIS API for JavaScript介绍
  10. Atan2