summaryrefslogtreecommitdiff
path: root/4p7.cpp
diff options
context:
space:
mode:
authorOskar <[email protected]>2024-08-16 19:00:04 +0200
committerOskar <[email protected]>2024-08-16 19:00:04 +0200
commitbfa29c55fd58912845b5a6684489231a4d4e675e (patch)
tree615213f43d685d7cc0b14cac0fcafe70cddb07e7 /4p7.cpp
parent6ff70adb810f1e194892398656e71f979f088feb (diff)
more exercises
Diffstat (limited to '4p7.cpp')
-rw-r--r--4p7.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/4p7.cpp b/4p7.cpp
new file mode 100644
index 0000000..8ad9d2e
--- /dev/null
+++ b/4p7.cpp
@@ -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;
+}