#include #include #include using namespace std; int main() { uint16_t operand1, operand2; char operation; cout << "Enter first operand: "; cin >> operand1; cout << "Enter operation (&, |, ^): "; cin >> operation; cout << "Enter second operand: "; cin >> operand2; uint16_t result = 0; if (operation == '&') result = operand1 & operand2; else if (operation == '|') result = operand1 | operand2; else if (operation == '^') result = operand1 ^ operand2; else { cout << "Invalid operation" << endl; return 1; } cout << "Hexadecimal: " << hex << setw(4) << setfill('0') << result << endl; cout << "Binary: " << bitset<16>(result) << endl; return 0; }