C++中各种类型int double long的表示范围
来源:互联网 发布:视频旋转软件中文版 编辑:程序博客网 时间:2024/05/22 05:26
#include<iostream>#include <limits>using namespace std;int main(){cout << "类型 \t\t" << "含义\t\t" << "字节" <<endl;cout << "int \t\t" << "整型\t\t" << sizeof(int);cout << "\t最大值:" << (numeric_limits<int>::max)(); cout << "\t\t最小值:" << (numeric_limits<int>::min)() << endl; cout << "float \t\t" << "单精度浮点型 \t" <<sizeof(float);cout << "\t最大值:" << (numeric_limits<float>::max)(); cout << "\t\t最小值:" << (numeric_limits<float>::min)() << endl; cout << "double \t\t" << "双精度浮点型 \t" << sizeof(double);cout << "\t最大值:" << (numeric_limits<double>::max)(); cout << "\t\t最小值:" << (numeric_limits<double>::min)() << endl; cout << "long \t\t" << "长整型 \t\t" << sizeof(long);cout << "\t最大值:" << (numeric_limits<long>::max)(); cout << "\t\t最小值:" << (numeric_limits<long>::min)() << endl; cout << "long long \t" << "长整型 \t\t" << sizeof(long long);cout << "\t最大值:" << (numeric_limits<long long>::max)(); cout << "\t最小值:" << (numeric_limits<long long>::min)() << endl; cout << "long double \t"<< "拓展精度浮点数 \t" <<sizeof(long double);cout << "\t最大值:" << (numeric_limits<long double>::max)(); cout << "\t\t最小值:" << (numeric_limits<long double>::min)() << endl; cout << "short \t\t" << "短整型 \t\t" << sizeof(short);cout << "\t最大值:" << (numeric_limits<short>::max)(); cout << "\t\t\t最小值:" << (numeric_limits<short>::min)() << endl; cout << "bool \t\t" << "布尔类型 \t" << sizeof(bool)<<endl;cout << "char \t\t" << "字符 \t\t" << sizeof(char)<<endl;cout << "string \t\t" << "字符串 \t\t" << sizeof(string)<<endl;return 0; }
上面程序的结果为
我是用64位机win10下DevC++编译运行的,每次去查这个范围都不一样,好像是跟编译器,编译环境有关,所以写清楚这个。
0 0
- C++中各种类型int double long的表示范围
- C/C++中各种类型int、long long、double表示范围(最大最小值)
- C/C++中各种类型int、long、double、char表示范围(最大最小值)
- C/C++中各种类型int、long、double、char表示范围(最大最小值)
- C/C++中各种类型int、long、double、char表示范围(最大最小值)
- C/C++中各种类型int、long、double、char表示范围(最大最小值)
- C/C++中各种类型int、long、double、char表示范围(最大最小值)
- C/C++中各种类型int、long、double、char表示范围(最大最小值)
- C/C++中各种类型int、long、double、char表示范围(最大最小值)
- C/C++中各种类型int、long、double、char表示范围(最大最小值)
- C/C++中各种类型int、long、double、char表示范围(最大最小值)
- C/C++中各种类型int、long、double、char表示范围(最大最小值)
- C/C++中各种类型int、long、double、char表示范围(最大最小值)
- C/C++中各种类型int、long、double、char表示范围(最大最小值)
- C/C++中各种类型int、long、double、char表示范围(最大最小值)
- C/C++中各种类型int、long、double、char表示范围(最大最小值)
- C/C++中各种类型int、long、double、char表示范围(最大最小值)
- C/C++中各种类型int、long、double、char表示范围(最大最小值)
- 友盟单点推送(推送给单个设备)
- React-Native Android集成Code-Push 热更新
- CUIT ACM Personal Training 11.27(FM)F - Polo the Penguin and Strings
- sql server 查看锁表
- ProtoBuf 与 gRPC 你需要知道的知识
- C++中各种类型int double long的表示范围
- 用户态与内核态
- grpc 的协议分析
- poj_1201_Intervals
- MT6582的KK版本,使用MTK_LCM_PHYSICAL_ROTATION旋转180度后,LK不会旋转
- swift ——~——~第三方网络请求封装
- 虚拟地址、线性地址和物理地址的转换
- 常用的cmd命令
- gRPC的简单Go例子