1 // 04-整型.cpp: 定义控制台应用程序的入口点。
2 //
3
4 #include "stdafx.h"
5 #include <iostream>
6 #include <climits>
7 using namespace std;
8
9 int main()
10 {
11 short a = 3;
12 int b = 100; //变量赋值需考虑变量范围,不能超过最大值,否则会出错。
13 long c = 900;
14 long long d = 100;
15
16 unsigned short e = 3;//unsigned 是无符号的类型,不支持负数。有符号的位数会比无符号的多。
17
18 cout << INT32_MAX << endl;
19 cout << INT32_MIN << endl;
20
21 cout << SHRT_MAX << endl;
22 cout << SHRT_MIN << endl;
23
24 short level = 8;
25
26 int t;
27 cin >> t;
28 return 0;
29 }