Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2012/5.0 > BOOK: Beginning Visual C# 2012
|
BOOK: Beginning Visual C# 2012
This is the forum to discuss the Wrox book Beginning Visual C# 2012 by Karli Watson, Jacob Vibe Hammer, Jon Reid, Morgan Skinner, Daniel Kemper, Christian Nagel, ; ISBN: 978-1-118-31441-8
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Visual C# 2012 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 27th, 2016, 07:50 AM
Registered User
 
Join Date: Sep 2016
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Try it out: Using a Struct: Ch05Ex03\Program.cs (Pg 91)

code
.
.
.
do
{
Console.WriteLine("Select a direction:");
myDirection = Convert.ToInt32(Console.ReadLine());
}
while ((myDirection < 1) || (myDirection > 4));
/code

In code above, since we are using the OR '||' instead of the '|', shouldn't the code executes even if the user input let say '5' for e.g. Because, when using the '||', normally if the first expression is correct, the code executes, isn't it, so why here it does not act this way. I.e. if I insert '5', it would give me the 'Select a direction' again, but this should have occurred if you had use the '&&' AND operator and not the OR operator.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Linked List pg 112 program difficulty amigo1 C# 4.0 aka C# 2010 General Discussion 1 May 1st, 2014 09:55 AM
pg.50 BootStapper.cs smiller BOOK: Professional ASP.NET Design Patterns 3 October 27th, 2010 10:49 AM
Cannot open in VCE a Program.cs file perloc C# 2008 aka C# 3.0 0 September 26th, 2010 01:51 AM
Error 91 GVBGVB Excel VBA 2 April 4th, 2008 12:56 AM
error 91 skrj02 Excel VBA 4 May 7th, 2007 11:01 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.