Wrox Programmer Forums
|
BOOK: Beginning Visual C#
This is the forum to discuss the Wrox book Beginning Visual C#, Revised Edition of Beginning C# for .NET v1.0 by Karli Watson, David Espinosa, Zach Greenvoss, Jacob Hammer Pedersen, Christian Nagel, Jon D. Reid, Matthew Reynolds, Morgan Skinner, Eric White; ISBN: 9780764543821
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Visual C# 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 May 9th, 2008, 01:42 PM
Registered User
 
Join Date: May 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 3 Page 51

I'm just beginning and I hope this question isn't too silly but I don't understand the statement:

firstNumber = Convert.ToDouble(console.ReadLine());

It is the Convert.ToDouble portion that I don't understand. I want to get a good handle on this before moving forward.

Your assistance is greatly appreciated!:)


 
Old November 7th, 2009, 01:25 PM
Authorized User
 
Join Date: Nov 2009
Posts: 26
Thanks: 1
Thanked 1 Time in 1 Post
Default

Hi

very good question.Thanks because you want to build the base and then move forward.

OK.Remember that when you input sth through console it is saved as a string.the complier treats it as a string or array of characetrs.firstNumber's type is certainly double,right?So can you save characters in a variable of type double?NO you can't.
because of this you convert every block of this array to double.although you have enterd
numbers,the compiler thinks it is a string like "dog"(4 example).

note that if your input contains any character like "2154A" you will encounter an exception and program terminates showing you the line that caused exception and you should handle this line.If you don't know about exception handling,don't panic,you will learn in following chapters.

Hope it Helps

Erfan...





Similar Threads
Thread Thread Starter Forum Replies Last Post
Typographical error on page 51 Ketil BOOK: Professional .NET 2.0 Generics 2 May 22nd, 2013 05:12 AM
Chapter 9 Page 304 AspNetGuy BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 12 December 22nd, 2009 11:17 AM
Error on source code 7-51? fedrok BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 1 October 15th, 2008 10:51 AM
select ONLY records 51-100 in a MySQL table crmpicco Classic ASP Databases 2 February 24th, 2005 07:21 AM
Chapter 1 page 74 dryan BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 2 June 16th, 2004 02:16 PM





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