C++ challenge: Sum of numbers
This one is fairly simple but it should help get you thinking about slightly different ways of doing things in C++.
This challenge is C++ only. If you can solve it in C, I will be extremely impressed, though.
Challenge: Write a program which reads integer values from standard input until EOF, then displays their sum on standard output. Do not worry about overflow.
The Goofy Part: Your program must contain EXACTLY ONE SEMICOLON. If you choose to "return 0;" at the end of main(), that semicolon does not count.
You may, and most likely will, use any and all features of standard C++ including STL.
Okay, I've received quite a few solutions
So how about: In one hour from the time of this message, the floor is open to people posting their solutions publicly. I've seen some good stuff so far.
When I get home I'll post my solution, which is also the solution given by a few other people. You know who you are -- you used a standard algorithm to compute the answer. Other people (MacGyver, twomer) feel free to post what you've got.