|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Logic Operators with 3 argumentsHi,
what is the appropriate way to to the following operations for three arguments (a,b,c) (wikipedia has definitions, in case): NAND, NOR, XNOR ? Thanks -P Just look at the truth table for these and you'll see how to do it.
http://hyperphysics.phy-astr.gsu.edu/HBASE/electronic/nand.html Private Function NAND(byval a as boolean, byval b as boolean, byval c as boolean) as boolean if a=True and b=True and c=True then Return False Return True End Function http://hyperphysics.phy-astr.gsu.edu/HBASE/electronic/nor.html Private Function NOR(byval a as boolean, byval b as boolean, byval c as boolean) as boolean if a=True or b=True or c=True then Return False Return True End Function http://hyperphysics.phy-astr.gsu.edu/HBASE/electronic/xnor.html Private Function XNOR(byval a as boolean, byval b as boolean, byval c as boolean) as boolean if a=b and a=c then Return True Return False End Function <pamelaflue***@libero.it> wrote in message Show quoteHide quote news:1159635805.329426.126350@e3g2000cwe.googlegroups.com... > Hi, > > what is the appropriate way to to > the following operations for three arguments (a,b,c) > (wikipedia has definitions, in case): > > NAND, NOR, XNOR ? > > Thanks > > -P > Terry Olsen ha scritto:
Thanks Terry, let's see tham for general numbers (bitwise operators, instead of boolean). If I understand correctly, you are suggesting: 1. Return Not (a and b and c) 2. Return Not (a or b or c) I am not sure for the 3-rd. Would that be: 3. Return Not (a xor b xor c) ?????????????? or what ? -P Show quoteHide quote > Just look at the truth table for these and you'll see how to do it. > > http://hyperphysics.phy-astr.gsu.edu/HBASE/electronic/nand.html > Private Function NAND(byval a as boolean, byval b as boolean, byval c as > boolean) as boolean > if a=True and b=True and c=True then Return False > Return True > End Function > > http://hyperphysics.phy-astr.gsu.edu/HBASE/electronic/nor.html > Private Function NOR(byval a as boolean, byval b as boolean, byval c as > boolean) as boolean > if a=True or b=True or c=True then Return False > Return True > End Function > > http://hyperphysics.phy-astr.gsu.edu/HBASE/electronic/xnor.html > Private Function XNOR(byval a as boolean, byval b as boolean, byval c as > boolean) as boolean > if a=b and a=c then Return True > Return False > End Function > |
|||||||||||||||||||||||