Click to See Complete Forum and Search --> : AND GATE(Neural networks)


praveenbabu_k
June 21st, 2002, 07:47 AM
How can i code in c++ an 'AND' gate using c++.Help me-urgent please..

zameericle
June 21st, 2002, 08:13 AM
&& <--- logical AND
& <--- bitwise AND

or did you want to overload & and provide your own?

Bob Davis
June 21st, 2002, 08:14 AM
Well, if you're doing some sort of binary logic, then you've got signals that are zeros and ones, much like boolean variables.

bool a, b, result;
// ... get a and b from somewhere
result = a && b; // perform logical and of a and b and place in result

You could save a lot of memory space if you only used one bit for each and stuffed like 8 results into a byte, using the bitwise and, but it looks like you're better off starting here.