#include #include int main() { //setlocale(LC_ALL, "Russian"); //int number = 0x412; // 1042 = ..._0100_0001_0010 //int mask = 0xF; // ..._0000_0000_1111 //std::cout << "Number: \t" << std::bitset<32>(number) << "\n"; //std::cout << "Mask: \t" << std::bitset<32>(mask) << "\n"; //number = number | mask; //std::cout << "Result: \t" << std::hex << number << "\n"; //std::cout << "Result: \t" << std::bitset<32>(number) << std::endl; /* unsigned short int number; std::cout << "Enter number: "; std::cin >> std::hex >> number; unsigned short int maska = 0xF7D7; std::cout << "Number: " << std::bitset<16>(number) << std::endl; std::cout << "Mask: " << std::bitset<16>(maska) << std::endl; number = number & maska; std::cout << "Result: " << std::hex << number << "\n"; std::cout << "Result: " << std::bitset<16>(number) << std::endl;*/ //unsigned short int number; //std::cout << "Enter number: "; //std::cin >> number; //std::cout << "Number: " << std::bitset<32>(number) << "\n"; //number = number << 4; // 4 = log2(16) //std::cout << "Result: " << std::bitset<32>(number) << "\n"; //std::cout << "Result: " << std::hex << number << "\n"; //unsigned short int number; //std::cout << "Enter number: "; //std::cin >> number; //std::cout << "Number: " << std::bitset<32>(number) << "\n"; //number = number >> 4; // 4 = log2(16) //std::cout << "Result: " << std::bitset<32>(number) << "\n"; //std::cout << "Result: " << std::hex << number << "\n"; //unsigned short int number; //int maska = 1 << (sizeof(int) * 8 - 1); //std::cout << "Enter number: "; //std::cin >> number; //int position; //std::cout << "Enter position "; //std::cin >> position; //std::cout << "Number: " << std::bitset<32>(number) << "\n"; //maska = maska << position; //std::cout << "Maska: " << std::bitset<32>(maska) << "\n"; //number = number | maska; //std::cout << "Result: " << std::bitset<32>(number) << "\n"; //std::cout << "Result: " << number; return 0; }