diff options
| Commit | 3d9b1b6f61a26f506cea1959fd0dfb430259ab35 (patch) | |
|---|---|---|
| Author | 2026-01-18 15:30:07 +0200 | |
| Committer | 2026-01-18 15:30:07 +0200 | |
| Files | e36ee10f828ae481e9b156179dafdd5b370904e3 /Week14/Exercise04.cpp | |
| upp-2025-solutions-main.tar upp-2025-solutions-main.tar.gz upp-2025-solutions-main.zip | ||
| Parent | 5c3b97fb2572ce8940439abd0652d2a7f7a623bd (diff) | |
1 files changed, 15 insertions, 0 deletions
| -rw-r--r-- | Week14/Exercise04.cpp | 15 |
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; +} |
