Here is the exercise which I need a little clarification on.
Write a table of values for the bitwise logical operations for all combinations of 0 and 1 operands.
Sounds simple
but he wants us to use an enumeration (which seems kind of pointless to me) I came up with this form
Code:
enum state_operands{bit_operand_result=0, bit_operand_one=1, bit_operand_two=2}
//now can I just
int state=bit_operand_result;
vector<state_operands> truth_table;
truth_table[0]=state&(bit_operand_one&bit_operand_two);
truth_table[1]=state&(bit_operand_one|bit_operand_two);
does this appear about correct I think this logic is wrong because I am not sure exactly what he means.
does he want
bool_result=bool_one & bool_two;
or somthing like I implemented.
I realize my implementation is wrong because it does not properly set the result bit.
How would I get a result in such an implementation?
This is C++ Programming Language Third Edition. 6.6 #4 and he refers to 6.2.4 the explanation on bitwise enumerations.