#include "pch.h"
#include <iostream>
#include <climits>
using namespace std;
int main()
{
bool bools = 1;
cout << "=============bool===============" << endl;
cout << "bool 判断整形 :" << bools << endl;
cout << "bool类型的长度:" << sizeof(bool) << "bytes" << endl;
char chars[] = "-127~128";
unsigned char uchars[] = "0~255";
cout << "=============char===============" << endl;
cout << "char 字符整形 :" << chars << endl;
cout << "char类型的长度:" << sizeof(char) << "bytes"<< endl;
cout << "unsigned char 无符号字符整形 :" << uchars << endl;
cout << "unsigned char类型的长度:" << sizeof(unsigned char) << "bytes" << endl;
cout << "相当于bool类型*256" << endl;
short shorts = SHRT_MAX;
unsigned short ushorts = USHRT_MAX;
cout << "=============short===============" << endl;
cout << "short 短整形 :" << shorts << endl;
cout << "short类型的长度:" << sizeof(short) << "bytes" << endl;
cout << "unsigned short 无符号短整形 :" << ushorts << endl;
cout << "unsigned short类型的长度:" << sizeof(unsigned short) << "bytes" << endl;
cout << "相当于char类型的平方" << endl;
int ints = INT_MAX;
unsigned int uints = UINT_MAX;
cout << "=============int===============" << endl;
cout << "int 整形 :" << ints << endl;
cout << "int类型的长度:" << sizeof(int) << "bytes" << endl;
cout << "unsigned int 无符号整形 :" << uints << endl;
cout << "unsigned int类型的长度:" << sizeof(unsigned int) << "bytes" << endl;
cout << "相当于short类型的平方" << endl;
long longs = LONG_MAX;
unsigned long ulongs = ULONG_MAX;
cout << "=============long==============="<< endl;
cout << "long 长整形 :" << longs << endl;
cout << "long类型的长度:" << sizeof(long) << "bytes" << endl;
cout << "unsigned long 无符号长整形 :" << ulongs << endl;
cout << "unsigned long类型的长度:" << sizeof(unsigned long) << "bytes" << endl;
cout << "与int 相等" << endl;
long long Tlongs = LLONG_MAX;
unsigned long long uTlongs = ULLONG_MAX;
cout << "=============long long===============" << endl;
cout << "long long 长整形 :" << Tlongs << endl;
cout << "long long 类型的长度:" << sizeof(long long) << "bytes" << endl;
cout << "unsigned long long 无符号长整形 :" << uTlongs << endl;
cout << "unsigned long long 类型的长度:" << sizeof(unsigned long long) << "bytes" << endl;
cout << "相当于int 或者 long 的平方" << endl;
float floats = FLT_MAX;
cout << "=============float===============" << endl;
cout << "float浮点型 :" << floats << endl;
cout << "float类型的长度:" << sizeof(float) << "bytes" << endl;
double doubles = DBL_MAX;
cout << "=============float===============" << endl;
cout << "double浮点型 :" << doubles << endl;
cout << "double类型的长度:" << sizeof(double) << "bytes" << endl;
}
数据类型
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 例如, 1.如果你的数据库使用int类型字段,允许为null】】】那么我们实体类使用integer时,即使不赋值,...
- 一、基本数据类型: byte:Java中最小的数据类型,在内存中占8位(bit),即1个字节,取值范围-128~1...
- 个人项目 个人站点: LN电影网 个人博客: L&N博客 写在前面: 除了之前提到的简单数据类型,PHP还拥有下面...
- 数据类型分为两种: 基本数据类型 指的是保存在栈内存中的简单数据段---字符串,数值,布尔,undefined,n...
- 1.php数据类型 标量(4种) 整型 int 浮点型 float 字符串 string 布尔类型 ...