diff options
author | Oskar <[email protected]> | 2024-08-16 19:00:04 +0200 |
---|---|---|
committer | Oskar <[email protected]> | 2024-08-16 19:00:04 +0200 |
commit | bfa29c55fd58912845b5a6684489231a4d4e675e (patch) | |
tree | 615213f43d685d7cc0b14cac0fcafe70cddb07e7 /4p7.cpp | |
parent | 6ff70adb810f1e194892398656e71f979f088feb (diff) |
more exercises
Diffstat (limited to '4p7.cpp')
-rw-r--r-- | 4p7.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -0,0 +1,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; +} |