hi, i am trying to write a simulation for a very simple ALU and am having trouble with the AND/OR operations. I want to AND/OR integers bit wise with the two integers being passed to a function in hex form and the result returned in hex form so :

int ANDoperation(0x0011, 0x0101)

would return: 0x0001.

iv tried to turn the int's into strings, compare them, then convert the result to int and return that but was having problems with that.

any help is appreciated

Make a function that takes 2 integers as parameters, and returns an integer.

You can print the result in hexadecimal form with the std::hex mode:

num = ANDoperation(0x0011, 0x0101);
std::cout << "0x" << std::hex << num;