Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int age, height, weight, combined, mask;
- age = 29; // 00000000 00000000 00000000 00011101
- height = 185; // 00000000 00000000 00000000 10111001
- weight = 80; // 00000000 00000000 00000000 01010000
- combined = age | (height << 8) | (weight << 16); //00000000 01010000 10111001 00011101
- mask = 0b11111111; // двоичный литерал
- printf("Age: %d, height: %d, weight: %d\n", mask & combined, mask & combined >> 8, mask & combined >> 16);
- // Age: 29, height: 185, weight: 80
- system("pause");
- }
Add Comment
Please, Sign In to add comment