Website Summary Files Commits Branches @commit @diff @stats
path: root / Week14 / Exercise04.cpp
diff options
context:
space:
mode:
Commit3d9b1b6f61a26f506cea1959fd0dfb430259ab35 (patch)
Author
 Syndamia <kamen@syndamia.com>
2026-01-18 15:30:07 +0200
Committer
 Syndamia <kamen@syndamia.com>
2026-01-18 15:30:07 +0200
Filese36ee10f828ae481e9b156179dafdd5b370904e3 /Week14/Exercise04.cpp
upp-2025-solutions-main.tar
upp-2025-solutions-main.tar.gz
upp-2025-solutions-main.zip
Parent5c3b97fb2572ce8940439abd0652d2a7f7a623bd (diff)
feat(Week14): Add solutions HEAD main
1 files changed, 15 insertions, 0 deletions
-rw-r--r--Week14/Exercise04.cpp15
diff --git a/Week14/Exercise04.cpp b/Week14/Exercise04.cpp
new file mode 100644
index 0000000..d02ef6b
--- /dev/null
+++ b/Week14/Exercise04.cpp
@@ -0,0 +1,15 @@
+#include <iostream>
+
+int main() {
+ unsigned int x;
+ std::cin >> x;
+
+ unsigned first = (x & (0b11111111 << 24)) >> 24;
+ unsigned second = (x & (0b11111111 << 16)) >> 16;
+ unsigned third = (x & (0b11111111 << 8)) >> 8;
+ unsigned fourth = x & 0b11111111;
+
+ std::cout << first << ' ' << second << ' ' << third << ' ' << fourth << std::endl;
+
+ return 0;
+}