Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer
This is the forum to discuss the Wrox book Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer by Rod Stephens; ISBN: 9780470596906
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 25th, 2012, 10:29 PM
Authorized User
Points: 130, Level: 2
Points: 130, Level: 2 Points: 130, Level: 2 Points: 130, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2012
Location: Australia
Posts: 32
Thanks: 1
Thanked 0 Times in 0 Posts
Default Xor Logical Operator Question

Hi,

On page 139 of the book it talks about Logical Operators.

In the definition of Xor (^) it states that "It returns true if one of its operands is true and the other is false".

It doesnt explain how Xor returns false though.

Logically speaking, if both operands are true or both operands are false, does that return a false Xor??

Also, with OR and XOR, are you limited to only two operands for comparison? I would assume with AND you could have more than two.
__________________
"These pretzels are making me thirsty"

Last edited by MinusZero; October 25th, 2012 at 10:35 PM.. Reason: Added another question
  #2 (permalink)  
Old October 25th, 2012, 11:53 PM
Rod Stephens's Avatar
Wrox Author
Points: 3,166, Level: 23
Points: 3,166, Level: 23 Points: 3,166, Level: 23 Points: 3,166, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2006
Location: , , .
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default

Quote:
In the definition of Xor (^) it states that "It returns true if one of its operands is true and the other is false".

It doesnt explain how Xor returns false though.
Sorry, it returns false otherwise. In other words, it returns false if both are true or both are false.

The truth table is:
T ^ T = F
T ^ F = T
F ^ T = T
F ^ F = F
Quote:
Also, with OR and XOR, are you limited to only two operands for comparison? I would assume with AND you could have more than two.
All of these operators take only 2 arguments (and "not" takes 1) but you can chain them together just like you can with + or -. For example:
A ^ B ^ C ^ D
is equivalent to:
((A ^ B) ^ C) ^ D
You can do similar things for || and &&.
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
  #3 (permalink)  
Old October 28th, 2012, 07:16 PM
Authorized User
Points: 130, Level: 2
Points: 130, Level: 2 Points: 130, Level: 2 Points: 130, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2012
Location: Australia
Posts: 32
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thanks, that helps me alot! :)
__________________
"These pretzels are making me thirsty"
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Invalid operator for data type. Operator equals di Pusstiu SQL Server 2000 2 August 10th, 2007 04:51 AM
Logical c# problem iinf C# 0 November 30th, 2006 10:33 AM
Question about Logical database design in ERwin method SQL Server 2000 3 November 24th, 2005 12:38 PM
XOR Two Arrays coderforrent.com C++ Programming 1 September 14th, 2004 12:57 PM



All times are GMT -4. The time now is 12:54 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.