diff options
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; +} |
