summaryrefslogtreecommitdiff
path: root/4p7.cpp
blob: 8ad9d2ed1d335e7a9c2c77b94a8a28d7adff0949 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>
#include <climits>

/*
 *
 * 4.7
 *
 *
 */

int main () {

	unsigned short int i = -1; // Underflow?
	std::cout << i << " " << std::endl;
	short int sii = 1;
	short int si = SHRT_MAX + sii; // Overflow
	std::cout << si << " " << std::endl;
	unsigned short int usii = 1; // Overflow
	unsigned short int usi = USHRT_MAX + usii;
	std::cout << usi << " " << std::endl;
	short int d = SHRT_MAX;
	short int f = SHRT_MAX + d;
	std::cout << f << " " << std::endl;
	return 0;
}