|
-
June 21st, 2002, 07:47 AM
#1
AND GATE(Neural networks)
How can i code in c++ an 'AND' gate using c++.Help me-urgent please..
-
June 21st, 2002, 08:13 AM
#2
&& <--- logical AND
& <--- bitwise AND
or did you want to overload & and provide your own?
-
June 21st, 2002, 08:14 AM
#3
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|