Wrox Programmer Forums
|
BOOK: Beginning Visual C# 2005
This is the forum to discuss the Wrox book Beginning Visual C# 2005 by Karli Watson, Christian Nagel, Jacob Hammer Pedersen, Jon D. Reid, Morgan Skinner, Eric White; ISBN: 9780764578472
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Visual C# 2005 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 5th, 2007, 08:51 AM
Authorized User
 
Join Date: Dec 2006
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapt 5, exercise 10

Hi

Just as a curiosity, did anyone understand the exercise 10 in chapter 5?

to make the whole story real short, here's what it is about :
Code:
int main (int argc, char* argv[])
{
  cout << sum(2,4,6,8,10,12) << endl;
  cout << sum(11,22,33,44,55,66,77,66,99) << endl;
}
** edit**
Strangely, the c++/cli example that uses the sum function works perfectly.

There must be an erratum section on this site, I think I'll try to find it.

Mister Hortons says that this example should produce the following output
10
172630728

My question is : why would sum(2,4,6,8...) only result in 10 ??

I didn't include the function sum in my example, but I would assume a sum function to calculate the sum of all arguments supplied to the function.

Em I missing anything? Most probably ;)

Thanks
Charles





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems in Chapt 9 pjwarez BOOK: Beginning Mac OS X Programming 0 August 30th, 2006 02:46 PM
Chapt 5 Help needed with Form4 example Getting_there_slowly BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 May 28th, 2005 10:42 AM
Chapt 13 auto_prepend_file dooz BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 2 November 20th, 2003 08:34 PM
Chapter 10 Enhanced File Info Display exercise err ssn651 BOOK: Beginning ASP 3.0 8 August 27th, 2003 10:35 AM





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