CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2002
    Posts
    1

    AND GATE(Neural networks)

    How can i code in c++ an 'AND' gate using c++.Help me-urgent please..

  2. #2
    Join Date
    Jun 2002
    Posts
    27
    && <--- logical AND
    & <--- bitwise AND

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

  3. #3
    Join Date
    Jan 2001
    Posts
    588
    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
  •  





Click Here to Expand Forum to Full Width

Featured