Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 4.0 aka C# 2010 > BOOK: Beginning Visual C# 2010
|
BOOK: Beginning Visual C# 2010
This is the forum to discuss the Wrox book Beginning Visual C# 2010 by Karli Watson, Christian Nagel, Jacob Hammer Pedersen, Jon D. Reid, Morgan Skinner, ; ISBN: 9780470502266
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Visual C# 2010 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 July 23rd, 2010, 07:47 AM
Registered User
 
Join Date: Jul 2010
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default Chapter 3 TRY IT OUT Manipulating Variables with Mathematical Operators

Hi,

I typed in and then pasted in the following from Beginning Visual C# 2010 but get two errors in three places in the static void Main(string[] args) (first) line.
I don't see any errors anywhere else in the code.

void = Expected class, delegate, enum, interface or struct
[] = string or identifier expected
args = Expected class, delegate, enum, interface or struct

Any help would be much appreciated

Thanks very much

static void Main(string[] args)
{
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 sum of {0} and {1} is {2}.", firstNumber,
secondNumber, firstNumber + secondNumber);
Console.WriteLine("The result of subtracting {0} from {1} is {2}.",
secondNumber, firstNumber, firstNumber - secondNumber);
Console.WriteLine("The product of {0} and {1} is {2}.", firstNumber,
secondNumber, firstNumber * secondNumber);
Console.WriteLine("The result of dividing {0} by {1} is {2}.",
firstNumber, secondNumber, firstNumber / secondNumber);
Console.WriteLine("The remainder after dividing {0} by {1} is {2}.",
firstNumber, secondNumber, firstNumber % secondNumber);
Console.ReadKey();
}
 
Old July 23rd, 2010, 07:49 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Cross post; please take a look here for replies: TRY IT OUT Manipulating Variables with Mathematical Operators

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Logical operators ksskumar XSLT 3 November 11th, 2011 06:09 AM
TRY IT OUT Manipulating Variables with Mathematical Operators bargeanimal C# 9 September 9th, 2010 09:23 AM
Mathematical puzzles Will BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3 13 May 30th, 2010 08:38 AM
plsql mathematical function RatanKumar SQL Language 1 May 29th, 2008 09:04 AM
How to do Mathematical expressions (seriously) Apocolypse2005 Beginning VB 6 5 December 15th, 2006 03:35 PM





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