473,408 Members | 2,405 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Logic Operators with 3 arguments

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

Sep 30 '06 #1
2 1796
Just look at the truth table for these and you'll see how to do it.

http://hyperphysics.phy-astr.gsu.edu...onic/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...ronic/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...onic/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

<pa***********@libero.itwrote in message
news:11**********************@e3g2000cwe.googlegro ups.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

Sep 30 '06 #2
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
Just look at the truth table for these and you'll see how to do it.

http://hyperphysics.phy-astr.gsu.edu...onic/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...ronic/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...onic/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
Oct 1 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: F. Petitjean | last post by:
I want to know if iter(iterator) returns always its argument (when argument is an iterator) So : >>> iterable = range(10) >>> it = iter(iterable) >>> that = iter(it) >>> that is it True #...
10
by: Axel Dahmen | last post by:
Hi, I want to start a technical discussion on the fact that C# doesn't define any mathematical operators on other integral types than int. Simple things like the following just aren't possible...
17
by: Steve R. Hastings | last post by:
I have been studying Python recently, and I read a comment on one web page that said something like "the people using Python for heavy math really wish they could define their own operators". The...
14
by: rabbitrun | last post by:
Hi Everyone, I work for a financial company. I am planning to give a presentation to rest of the development team (15 people) here on moving server side logic to client-side javascript for an...
3
by: Noodle | last post by:
Hi Guys, not sure if anyone can help me on this one but...... I have a class that I overload the equality operator (=). I also have a class that inherits from this first class which has extra...
11
by: Jim Michaels | last post by:
friend fraction& operator+=(const fraction& rhs); fraction.h(64) Error: error: 'fraction& operator+=(const fraction&)' must take exactly two arguments I practically pulled this out of a C++...
39
by: vlsidesign | last post by:
Operators seem similar to functions. They both do something to either arguments or operands, but are different in their syntax. Operators seem to be like built-in C functions. It would seem that...
3
by: Kevin Audleman | last post by:
I wrote a piece of boolean logic that doesn't work and I don't know why. The code should ONLY do something if the session variable is equal to 900123: if( ! $_SESSION == '900123') { //do some...
2
by: jimzat | last post by:
I am trying to simulate the execution of some PLC ladder logic in python. I manually modified the rungs and executed this within python as a proof of concept, but I'd like to be able to skip the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.