Wrox Programmer Forums
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 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 22nd, 2009, 03: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.
Old September 23rd, 2009, 04:47 PM
Friend of Wrox
Join Date: Feb 2009
Posts: 194
Thanks: 5
Thanked 3 Times in 3 Posts

I noticed this as well it should be:

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);
Old November 7th, 2009, 04:45 AM
Authorized User
Join Date: Nov 2009
Posts: 26
Thanks: 1
Thanked 1 Time in 1 Post

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

The Following User Says Thank You to sh_erfan For This Useful Post:
jawadh_khan786 (January 3rd, 2010)
Old January 3rd, 2010, 01:00 AM
Registered User
Join Date: Dec 2009
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:
category: Binary
Eg Expression:
 var1 = var2 - var3
var1 is assigned the value that is the value of var3 subtracted from the value of var2.


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

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

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

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

Regards C# expert

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

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 08: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 04:32 AM

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