Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning Microsoft Visual C# 2008 ISBN: 978-0-470-19135-4
This is the forum to discuss the Wrox book Beginning Microsoft Visual C# 2008 by Karli Watson, Christian Nagel, Jacob Hammer Pedersen, Jon D. Reid, Morgan Skinner, Eric White; ISBN: 9780470191354
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Microsoft Visual C# 2008 ISBN: 978-0-470-19135-4 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 Display Modes
  #1 (permalink)  
Old September 22nd, 2009, 04:26 AM
Registered User
 
Join Date: Sep 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Correction to page 49

Not that it is that important but if you wanted to reuse the code.

The text in the WriteLine for subtraction states that you subtract firstNumber from secondNumber when infact the code subtracts secondNumber from firstNumber.
  #2 (permalink)  
Old September 23rd, 2009, 05:47 PM
Friend of Wrox
 
Join Date: Feb 2009
Posts: 194
Thanks: 5
Thanked 3 Times in 3 Posts
Default

I noticed this as well it should be:

Code:
double firstNumber, secondNumber;
            string userName;
            Console.WriteLine("Enter your name");
            userName = Console.ReadLine();
            Console.WriteLine("welcome {0}!", userName);
            Console.WriteLine("Now give me a number:");
            firstNumber = Convert.ToDouble(Console.ReadLine());
            Console.WriteLine("now give me another number:");
            secondNumber = Convert.ToDouble(Console.ReadLine());
            Console.WriteLine("the result of subtracting {0} and {1} is {2}.", firstNumber, secondNumber,
                firstNumber - secondNumber);
            Console.ReadKey();
  #3 (permalink)  
Old November 7th, 2009, 04:45 AM
Authorized User
Points: 100, Level: 1
Points: 100, Level: 1 Points: 100, Level: 1 Points: 100, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2009
Posts: 26
Thanks: 1
Thanked 1 Time in 1 Post
Default

As will said the code is correct.It states that you subtract secondNumber from firstNumber.

pay attention to this code:
x=firstNumber - secondNumber;
this means that you lessen socondNumber from firstNumber and assign it to x(a vriable to hold value).so the statement we order the compiler to do in this code is "subtract secondNumber form firstNumber".

I hope could help

Erfan...
The Following User Says Thank You to sh_erfan For This Useful Post:
jawadh_khan786 (January 3rd, 2010)
  #4 (permalink)  
Old January 3rd, 2010, 01:00 AM
Registered User
 
Join Date: Dec 2009
Location: Hyderabad, AP, India
Posts: 4
Thanks: 1
Thanked 1 Time in 1 Post
Send a message via Yahoo to jawadh_khan786
Lightbulb Pay attention here

Hello C# learners and programmers

Depending on your query here... please pay attention on the page no. 47, and in the table provide observe carefully the second row on -(subtraction operator)

Operator is:
Code:
 -
category: Binary
Eg Expression:
Code:
 var1 = var2 - var3
Result:
var1 is assigned the value that is the value of var3 subtracted from the value of var2.

Example:

if we want to subtract 5(firstNumber) from 10(secondNumber) then the code below is invalid

Code:
Console.WriteLine("The result of subtracting {0} from {1} is: {2}.", firstNumber, secondNumber, firstNumber - secondNumber);
Execution of above code gives annoying result

Code:
 The result of subtracting 5 from 10 is: -5
Hence the code below is perfectly valid

Code:
 Console.WriteLine("The result of subtracting {0} from {1} is: {2}.", firstNumber, secondNumber, secondNumber - firstNumber);

Cheers!!!
Regards C# expert
SparkSoft®

Last edited by jawadh_khan786; January 3rd, 2010 at 01:03 AM.
 


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
Page 123 - Login Box Correction xumuskiefan BOOK: Professional Crystal Reports for VS.NET 1 February 2nd, 2006 01:06 PM
Subscript out of range: '[number: 49]' hameed Classic ASP Databases 2 August 5th, 2004 09:32 AM
Config Apache 2.0.49 for PHP4.3.5Win32 Domonsura BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 July 22nd, 2004 05:32 AM



All times are GMT -4. The time now is 03:39 AM.


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