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

July 24th, 2003, 03:39 PM
|
|
Registered User
|
|
Join Date: Jul 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Chapter three answers
Has anyone completed the exercises from chapter three, I just want to check my answers
q 1 super.smashing.great
q2
a yes
b no
c yes
d yes
e no
q3 its not too big
q4 in the order of * / % +
|
|

July 29th, 2003, 07:30 AM
|
|
Registered User
|
|
Join Date: Jul 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi:
I believe your answers are OK, but what about q5?.
Rafael18016
|
|

July 30th, 2003, 09:51 AM
|
|
Registered User
|
|
Join Date: Jul 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi,
ur answers r fine but if u go from left to right in equal precedence operators the sequence wud be * % / + += in Q 4. which is resultVar += var1 * var2 + var3 % var4 / var5 ;
|
|

July 30th, 2003, 12:38 PM
|
|
Registered User
|
|
Join Date: Jul 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Trying to code Q 5. Pl correct me if i am wrong. am very new to .Net in fact i am just trying to install .NET framework SDK.
/*This program takes 4 integers and displays their product. Beg_C_sharp Chapter 3 Question 5. */
using system
static void Main(string[] args)
{
double dVar1 = 0.0, dVar2 = 0.0;
double dVar3 = 0.0, dVar4 = 0.0;
double dProduct = 0.0;
Console.WriteLine("Enter 1st number :");
dVar1 = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter 2nd number :");
dVar2 = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter 3rd number :");
dVar3 = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter 4th number :");
dVar4 = Convert.ToDouble(Console.ReadLine());
dProduct = dVar1 * dVar2 * dVar3 * dVar4 ;
Console.WriteLine("The product of {0}, {1}, {2} and {3} is {4}", dVar1, dVar2, dVar3, dVar4, dProduct)
}
|
|

September 24th, 2003, 10:33 PM
|
|
Registered User
|
|
Join Date: Sep 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
According to kjain92's code the Q 5 would be this;
/*This program takes 4 doubles and displays their product. Beg_C_sharp Chapter 3 Question 5. */,wouldn't it?
What confused me is whether or not the type "int" belongs to "double". I think not.
However, the Q 5 gives another hint that is "Using 'Convert.ToInt32()' while turn from 'string' to 'int' ". But he above hadn't use it.
How I wish that the true answer written by the author show it here again.
|
|

September 27th, 2003, 12:46 AM
|
|
Registered User
|
|
Join Date: Sep 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Can someone tell me why this code compiles but throws errors when run? I get an error that has to do with the wrong type being used. Im pulling my hair out!
int firstNumber, secondNumber, thirdNumber, fourthNumber;
Console.WriteLine("Enter a number: ");
firstNumber = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Now enter a second number: ");
secondNumber = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Now enter a third number: ");
thirdNumber = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Now enter a final number: ");
fourthNumber = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("The product of {0} {1} {2} and {3} is (4}." ,
firstNumber, secondNumber, thirdNumber, fourthNumber,
frstNumber * secondNumber * thirdNumber * fourthNumber);
|
|

September 27th, 2003, 12:54 AM
|
|
Registered User
|
|
Join Date: Sep 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Never mind, I saw that I used the wrong kind of brace on the {4} placeholder after I posted the msg =P. I guess using this msgboard really DOES help.
|
|
 |