p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning Visual C# 2005 (http://p2p.wrox.com/forumdisplay.php?f=222)
-   -   Chapt 5, exercise 10 (http://p2p.wrox.com/showthread.php?t=57507)

SolarEnergy May 5th, 2007 08:51 AM

Chapt 5, exercise 10

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 :

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

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


All times are GMT -4. The time now is 02:45 PM.

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