7302人加入学习
(18人评价)
C++编程系列 第一季编程基础

制作于2018年2月7日

价格 免费

其他数据类型

整数

short

int

long

long long

unsignde int=数值大于等于0且数值翻倍

[展开全文]

 

 

short

int

long

long long

整数类型

 

unsigned int 无符号的数 (负数) 正数翻倍cun'cu

[展开全文]
  •  int:-2147483647~2147483647
  • short:-32768~32768
[展开全文]

关键字 unsigned 定义整型 代表无符号

[展开全文]

short整形    int一个亿都可以存储

short 比较小的数据   INT32_Max多少位

 

min单位

short类型是3w   int类型是20亿  

long类型是上百亿

unsigned short e =无符号的

[展开全文]

命名规则,类型 + 字符串

类型存在范围,不能超出范围

unsigned 使数据无符号,不能存在负数

[展开全文]

 

// unsigned short e = -3;
// cout << e << endl; // 输出:65533 
// unsigned short 类型 范围:0~65535
// 0 65535 65534 65533
// 0 -1        -2        -3

#include <iostream>

#include <climits>

using namespace std;

 

int main()

{

// 类似:超市购物买袋子,袋子大小放的东西多大

short a = 3;

int b = 100;

long c = 900;

long long d = 100;

 

cout << INT_MAX << endl; // 输出:2147483647 // 21亿

cout << INT_MAX << endl; // 输出:-2147483648

 

cout << SHRT_MAX << endl; // 输出:32767 // 3万

cout << SHRT_MAX << endl; // 输出:-32768

 

short level = 8;

 

unsigned short e = 3; // unsigned 无符号的

// unsigned short e = -3;

// cout << e << endl; // 输出:65533

// unsigned short 类型 范围:0~65535

// 0 65535 65534 65533

// 0 -1 -2 -3

 

// int b = 100000000000;

// cout << b << endl; // 输出:1215752192

 

int b = 400000000;

unsigned int f = 4000000000; // unsigned 比原来扩大2倍

cout << b << endl; // 输出:-294967296

cout << f << endl; // 输出:4000000000

 

int t;

cin >> t;

return 0;

}

 

百度:

C++ 整形 范围

https://blog.csdn.net/kazama_kenji/article/details/52229533

[展开全文]

授课教师

SiKi学院老师

课程特色

下载资料(1)
视频(58)