#include "calc_bits.h" #include "lab04.h" #include #include uint16_t perform_bitwise_operation(uint16_t operand1, char operation, uint16_t operand2) { uint16_t result; switch (operation) { case '&': result = operand1 & operand2; break; case '|': result = operand1 | operand2; break; case '^': result = operand1 ^ operand2; break; default: std::cerr << "Invalid operator. Please use '&', '|', or '^'." << std::endl; result = 0; break; } return result; } void print_calculation(uint16_t result) { std::cout << "Result in Hex: "; print_in_hex(result); std::cout << "\nResult in Binary: "; print_in_binary(result); std::cout << std::endl; }