Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 2012/5.0 > BOOK: Beginning Visual C# 2012
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old September 27th, 2016, 07:50 AM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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.
Reply With Quote
Reply


Thread Tools
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
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



All times are GMT -4. The time now is 11:40 AM.


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